-
January 12th, 2010, 07:37 PM
#1
Formatting of unchanged values in "DynaScrollTable"
While searching through the forum to see if I could find some information regarding a problem with value-formatting while using a "DynaScrollTable" I came across this response by Dario Crivelli in a thread regarding the "addField" method:
![Quote](images/styles/AestheticaGreen/misc/quote_icon.png)
Originally Posted by
DarioCrivelli
[...]
However, in the onChangingValues callback (the place where formatting instructions can be given to the VisualTable), the previous values of the updated fields are not available.
On the other hand, they are available in the onItemUpdate callback.
[...]
Out of curiosity, why did you chose to make the previous values available only in "onItemUpdate" and not in "onChangingValues"?
We actually are dealing with this "problem" on one of our sites at the moment. We have a "DynaScrollTable" receiving updates containing a timestamp, an identifier (string) and two decimal numbers. We need to format the numbers before displaying them (rounding decimal places, insert thousands separator - e.g. original value is "12345.6" and should be displayed as "12.345,600"), and it normally works like it should..
..but sometimes only one of the two numbers changes, so when our "onChangingValues"-function gets called I can't access the value that the unchanged field previously had, as "updateInfo.getFormattedValue("number2")" is "null". As we don't know the previous value we're not able to format it, and the unformatted value is displayed in the table.
Ideally I would write something like this in "onChangingValues":
..but I don't have access to the old value in "onChangingValues". At the moment the only way I see to get it to work would be to add some logic to the "onItemUpdate"-function, check if there are fields that did not change, and then add the old values of those fields via "UpdateItemInfo.addField(...)", so that I have the old value available in "onChangingValues" - I can't format the respective field in the "onItemUpdate"-function as I can read the value but not write it back into the field ("addField()" can only be used to add extra fields).
I don't really like this "solution" as it looks to me to be quite inelegant, but I don't see any other solution - perhaps I'm missing something simple or obvious as I assume that this is not an unusual use-case, but looking through the online documentation didn't give me some better idea yet.
Ideally, for an unchanged field, the table should just reuse the last set value of "setFormattedValue()" for the specific field, so my code could just ignore unchanged values, but the web client api doesn't seem to behave like this, at least on our site.
I also looked through the Changelog for the Web Client SDK, to see if there was some change or bugfix that related to formatted values, but I did not find anything there, either.
Any idea or comment is appreciated.
Similar Threads
-
By Mone in forum Client SDKs
Replies: 1
Last Post: July 10th, 2012, 06:06 PM
-
By enrico in forum Client SDKs
Replies: 2
Last Post: March 1st, 2012, 01:53 PM
-
By hofmanna in forum Client SDKs
Replies: 3
Last Post: February 18th, 2010, 11:14 PM
-
By Otake in forum Client SDKs
Replies: 2
Last Post: December 17th, 2009, 02:13 PM
-
By jondcruz in forum General
Replies: 1
Last Post: September 18th, 2009, 09:13 AM
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
All times are GMT +1. The time now is 03:28 AM.
Bookmarks