Bug after sorting a column...
I'm using a JS Array to store data. I add new items to the array and delete them, and then refresh the grid ok -- all works as expected. The problem comes when I sort a column. If I add a new array item the grid fails to show the new item on a refresh. Similarly, if I delete an item the grid shows a blank/empty row after a refresh.
Is there a workaround for this bug?
Thanks
Steve N
June 23,
Forgot to mention -- after each insert or delete I'm updating the row "count" property...
obj.setRowProperty("count", aData.length);
Any ideas anyone??
Steve N
June 24,
You can find several posts about this issue, just search for "reload/reset row values".
When add or del a row, the "values" function (in charge of store sorting data):
obj.setDataText = function(value, i, j){myData[i][j]=value}
Need to be updated with new values (I use this function) but other use different ways to do it.
var datalen=myData.lenght;
function resetRowValuesGrid1()
{
obj.setRowCount(datalen);
var rowValues = [];
for(var i=0; i < datalen; ++i) { rowValues.push(i);}
obj.setRowProperty("values", rowValues);
obj.setSortProperty("index", null);
}
///////////////
Also for xml/csv data-model check this post, but I think this patch is ver1.1 included .... is it?
http://activewidgets.com/javascript.forum.1788.24/bug-caused-by-sorting.html
Carlos
June 24,
Thanks Carlos. I've read the other posts.
I've found a possibly simpler solution than using an expensive for-loop:
var a = obj.getRowProperty("values");
aData.push(aNewData);
a.push(aData.length - 1);
obj.setRowProperty("values", a);
obj.setRowProperty("count", aData.length);
obj.refresh();
Alex... would you consider this issue a bug that needs to be fixed?
Thanks
Steve N
June 24,