This is a migrated thread and some comments may be shown as answers.

change data after loading

1 Answer 65 Views
Data Source
This is a migrated thread and some comments may be shown as answers.
Aidan
Top achievements
Rank 1
Aidan asked on 17 Feb 2012, 12:01 PM
Hi,

Currently i'm loading data from a json file so i can fill a listview (mobile) with the data.
Is it possible to change the data? For example I have a string: "20040000 - Intern". I would like to be able to remove the first part of the string before showing the data in the listview. Would anyone know if this is possible and if so, how?

1 Answer, 1 is accepted

Sort by
0
Accepted
Andrew
Top achievements
Rank 1
answered on 17 Feb 2012, 03:11 PM
Have you tried implementing a parse function in your Datasource? 

...
// Converts the incoming myrec.datefld from a string to an actual date object (using DateJS)...
parse : function(data) {
  $.each(data.myrec, function(i, val){
    val.datefld = Date.parse(val.datefld);
  });
  return data;
}
...

If you are editing the data, you will need to have a ParameterMap function when you put the data back on the server that reconstructs the proper value....
Tags
Data Source
Asked by
Aidan
Top achievements
Rank 1
Answers by
Andrew
Top achievements
Rank 1
Share this question
or