Page 1 of 1
change values during mapping
Posted: Tue May 07, 2013 8:07 am
by w
How to change the value of a service response while mapping? For example, an array of telephone numbers is mapped to a grid.
I want to change the value of the telephone numbers dynamically, based upon the value that is being received.
change values during mapping
Posted: Tue May 07, 2013 8:12 am
by w
Now i have this in the "edit js" section of the mobile grid:
if (value.DIASType_obj == "15580.100001" ) {
value.CleanedValue = "+" + str.pop();
}
return value;
change values during mapping
Posted: Tue May 07, 2013 8:15 am
by w
Everything in the "edit js" section is working (the str variable is initialized before) according to the console.log that i did. It is just that value.CleanedValue doesn't get a new value, it just shows the initial value in the grid. It is like the statement "value.CleanedValue = xxx" doesn't change the actual value.CleanedValue
change values during mapping
Posted: Tue May 07, 2013 8:55 am
by Oleg Danchenkov
You can't change value.CleanedValue in mapping
"value" is a local variable.
If you need to set lblCommunicatieValue.text depending on DIASType_obj value then you can just set the value manually in JS (without mapping from CleanedValue to lblCommunicatieValue.text).
Change your JS in mapping:
precodeif (value.DIASType_obj == "15580.100001" ) {
$('[dsid=lblCommunicatieValue]', element).text("+" + str.pop());
} else { //you need this section because now there is no mapping from CleanedValue to lblCommunicatieValue.text
$('[dsid=lblCommunicatieValue]', element).text(value.CleanedValue);
}
/code/pre
change values during mapping
Posted: Tue May 07, 2013 9:06 am
by w
If value is a local value, what is the "return value" statement for in the "edit js" sections?
Also, if you do "return 'xxx' " in the "edit js" section of lblCommunicatieValue, then the 'xxx' is shown in the label, how does that work then?
change values during mapping
Posted: Tue May 07, 2013 9:58 am
by Oleg Danchenkov
Returned value is used as new value for this particular component.