Turns out this problem gets even more interesting. Realized that after all that I had forgotten that during my
testing I added a column in the colModel as such
{
For anyone interested please refer to http://www.trirand.com/blog/?page_id=393/bugs/rowid-parameter-in-addrowdata-does-not-function-correctly/ for solution.
Ok so I worked out what was going on.
The problem is the $(“#tableSearch”).trigger(“reloadGrid”); method. However this must be called
to enable paging to work with local data (It does work fine once this is called)
The problem with the method is it causes a call to the addJSONData method which in turn contains the following line
|
1 |
var dReader = ts.p.datatype == "local" ? ts.p.localReader : ts.p.jsonReader, locid, locdata = (ts.p.datatype != "local" && ts.p.loadonce) || ts.p.datatype == "jsonstring";</code><br /> |
this is where the problem is. At this point whatever is set as your localreader id value is now
being used rather then the original rowID value, hence since your object (in my case)
doesnt contain the default value id a new rowid is generated and bammm your old values are
thrown out.
So basically the temp solution to this is to add the following to your original declaration
|
1 |
|
1 |
localReader: |
I can confirm without question that this is a bug. (Will post in bug forum)
Still trying to work out how to fix it.
Code to recreate problem:
After all that it doesnt work. It only worked with my test data as I was using integers for my IDs in my test.
There appears to be some specialized code inside the addRowData method that (ONLY IN THE CASE OF LOCAL DATA) deletes the predefined key and sets it to the length of the data array. (I Could be wrong though – still testing where its happening exactly)
This is the code here (at least I think)
|
1 |
if(t.p.datatype |
OK so for anyone interested I ended up looking at the source code and worked it out….
The first param of the addRowData method is actually the NAME of the id column in your dataset…
So basically this is how you would do it…
var data =
Thank you so much. I was unaware you could pass an array into that method.
One last issue I am having with is how to pass in the IDs for each row.
Passing an array of IDs to the .addRowData() method doesnt seem to work, nor does passing an ID parameter as part of the data definition. Could you advise what I might be doing wrong?
Have tried…
var data = [{
OlegK said:
You can use addRowData method.
Best regards
Oleg
Copyright 2014 TriRand LtdAll Rights ReservedRSS
Back to Top