3.2.0

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
April 8,
>> 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)
April 8,
yes, exactly. basically, without clicking the browser refresh, how to undo the filter and see all rows.

thank you.
Dave
April 8,
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)
April 8,

This topic is archived.

See also:


Back to support forum