:: Forum >>

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
Thursday, June 23, 2005
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
Friday, June 24, 2005
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
Friday, June 24, 2005
Thanks Carlos. I've read the other posts.

I've found a possibly simpler solution than using an expensive for-loop:

// get the grid row indices
var a = obj.getRowProperty("values");

// add new row
aData.push(aNewData);

// update grid row indices
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
Friday, June 24, 2005

This topic is archived.


Back to support forum

Forum search