Results 1 to 2 of 2
  1. #1
    Member
    Join Date
    Feb 2009
    Location
    Johannesburg
    Posts
    2

    Formatting unchanged items...

    I want to do a simple thing. Based on the value of an item, I wish to change the formatting of another item.

    Like for example, if my checking item is say 'Confirmed', and if 'Confirmed is 1, the format the Status item as green, and if not then make it red.

    My problem is that it works only when status has changed. In other words, the formatting applies to the status item only when the value of status item has changed from before.

    Heres some code...

    Data.onItemUpdate = updateItem;
    Data.onChangingValues = formatValues;

    //....

    function formatValues(item, itemUpdate)
    {
    ///...

    if(itemUpdate.getServerValue("Confirmed") == "1")
    {
    itemUpdate.setAttribute("ItemStatusField" ,ColorNeutral, ColorPositive,"backgroundColor");
    }
    }


    In the above code... the colors change only if the value of "ItemStatusField" has changed in the current update.

    Why is it like this? What do I do?

    Thanks in advance!!
    WK

  2. #2
    Administrator
    Join Date
    Jul 2006
    Location
    Milan
    Posts
    986
    Indeed, the change of the cell content related to a field is driven by the formatted value assigned to the field.
    By convention, if a field value doesn't change, it gets a default formatted value of null, which means that the cell should not change on the screen; in this case, the "setAttribute" call is ignored (this probably turns out to be a misleading convention).

    You can enforce the cell change by reassigning the formatted value for the field,
    which you could have cached,
    or could recompute, based on the current server value, as returned by "getServerValue" (that is always valued, even for unchanged fields).

    See the setFormattedValue jsdoc.

 

 

Similar Threads

  1. Formatting of unchanged values in "DynaScrollTable"
    By hofmanna in forum Client SDKs
    Replies: 5
    Last Post: January 14th, 2010, 10:02 AM
  2. Are unchanged values broadcasted?
    By Otake in forum Client SDKs
    Replies: 2
    Last Post: December 17th, 2009, 02:13 PM
  3. Formatting RAW data: Necessary?
    By Isanderthul in forum Adapter SDKs
    Replies: 5
    Last Post: July 30th, 2009, 11:34 AM
  4. UNCHANGED Items
    By lauraw in forum Client SDKs
    Replies: 2
    Last Post: July 25th, 2007, 11:06 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT +1. The time now is 03:44 PM.