locked
conditional formatting RRS feed

  • Question

  • A listview has three elements: name, address and zip code. What I want to do is that when a zip code is say 11111 I want to use conditional formatting to color the zip code for just that entry. I have been able to do the conditional formatting but it always colors all of the entries.

    Thanks

    Monday, April 8, 2013 2:58 PM

Answers

  • Hi B,

    We have no idea what you have tried so we really can't comment on what you may or may not be doing correctly!

    -Jeff


    Jeff Sanders (MSFT)

    • Marked as answer by baryo Tuesday, April 16, 2013 11:08 PM
    Wednesday, April 10, 2013 1:42 PM
    Moderator
  • Below is the answer to my problem. Using the WinJS.Utilities.query gave me what I was looking for.
    I have included the html and the script. The result I was looking for was to change the
    color on the text objects innerText for the h6 tag. Here is a complete listing of the code that lead me to
    the correct path - http://www.renauddumont.be/post/2013/01/24/Windows-8-HTMLJS-VariableSize-List-View-and-Template-Selection

    <div id="mediumListIconTextTemplate" data-win-control="WinJS.Binding.Template">
        <div class="mediumItem">
            <h4 data-win-bind="innerText: title"></h4>
            <h6 data-win-bind="innerText: text"></h6>
        </div>
    <div>

    var itemTemplate = WinJS.Utilities.query("#mediumListIconTextTemplate")[0];
    var itemChange = WinJS.Utilities.query("h6")[0];
    itemChange.style.color = "blue";

    • Marked as answer by baryo Tuesday, April 16, 2013 11:08 PM
    Tuesday, April 16, 2013 11:08 PM

All replies

  • Hi B,

    We have no idea what you have tried so we really can't comment on what you may or may not be doing correctly!

    -Jeff


    Jeff Sanders (MSFT)

    • Marked as answer by baryo Tuesday, April 16, 2013 11:08 PM
    Wednesday, April 10, 2013 1:42 PM
    Moderator
  • Below is the answer to my problem. Using the WinJS.Utilities.query gave me what I was looking for.
    I have included the html and the script. The result I was looking for was to change the
    color on the text objects innerText for the h6 tag. Here is a complete listing of the code that lead me to
    the correct path - http://www.renauddumont.be/post/2013/01/24/Windows-8-HTMLJS-VariableSize-List-View-and-Template-Selection

    <div id="mediumListIconTextTemplate" data-win-control="WinJS.Binding.Template">
        <div class="mediumItem">
            <h4 data-win-bind="innerText: title"></h4>
            <h6 data-win-bind="innerText: text"></h6>
        </div>
    <div>

    var itemTemplate = WinJS.Utilities.query("#mediumListIconTextTemplate")[0];
    var itemChange = WinJS.Utilities.query("h6")[0];
    itemChange.style.color = "blue";

    • Marked as answer by baryo Tuesday, April 16, 2013 11:08 PM
    Tuesday, April 16, 2013 11:08 PM