:: Forum >>

grid refresh

I have pondered over the many grid refresh items and still cannot get this to operate. Can someone help? Thank you.

I have functions of this type:

function w1(){ var i, rows = [], max = obj.getRowCount(); for (i=0; i<max; i++){if (obj.getCellValue(1, i) == "W1"){rows.push(i);} } obj.setRowCount(rows.length); obj.setRowIndices(rows); }

triggered by this button:

var button = new AW.UI.Button; button.setControlText("W1"); button.onClick = w1; document.write(button);

I am unable to get obj.refresh() to work so that all rows are displayed. How to do this? Thank you.

related -- how to use a simple combobox for triggering rather than button -- all examples I find are too complex. Thank you.
Dave
Tuesday, April 8, 2008
>> I am unable to get obj.refresh() to work so that all rows are displayed

Sorry, don't understand what exactly are you asking. Are you trying to remove the filter and display all rows again?
Alex (ActiveWidgets)
Tuesday, April 8, 2008
yes, exactly. basically, without clicking the browser refresh, how to undo the filter and see all rows.

thank you.
Dave
Tuesday, April 8, 2008
Assuming your datasource is a CSV or XML table, here is the corrected filter code -

function applyFilter(s){
    var i, rows = [];
    var max = table.getCount();

    for (i=0; i<max; i++){
        if (table.getData(1, i) == s){ // column-1
            rows.push(i);
        }
    }
    obj.clearRowModel();
    obj.clearSortModel();
    obj.clearScrollModel();

    obj.setRowCount(rows.length);
    obj.setRowIndices(rows);
}


and also the function which shows all rows again -

function showAll(){
    obj.clearRowModel();
    obj.clearSortModel();
    obj.clearScrollModel();

    obj.setRowCount(table.getCount());
    obj.refresh();
}
Alex (ActiveWidgets)
Tuesday, April 8, 2008

This topic is archived.


Back to support forum

Forum search