Restoring the filter list

2 replies. Last post: November 11, 2010 9:38 AM by John Valentin
Tags :
  • (None)
  • New Discussion
  • New Question
  • New Product Feedback

I have a grid and I execute the following code when the document is loaded in JavaScript. This code sets filters passed in from another web page.

 

var grid = ISGetObject("grdInvoiceLink");
var newFilter;

var oMyObject = window.dialogArguments;

if (oMyObject.vendor != "") {
    newFilter = new WebGridFilter()
    newFilter.ColumnMember = "vendor"
    newFilter.FilterType = oMyObject.vendorFilterType;
    newFilter.FilterText = oMyObject.vendor
    grid.RootTable.FilteredColumns.Add(newFilter);
    grid.RootTable.UpdateUI();
}

if (oMyObject.accountNumber != "") {
    newFilter = new WebGridFilter()
    newFilter.ColumnMember = "account_nbr"
    newFilter.FilterType = oMyObject.accountNumberFilterType;
    newFilter.FilterText = oMyObject.accountNumber
    grid.RootTable.FilteredColumns.Add(newFilter);
    grid.RootTable.UpdateUI();
}

if (oMyObject.btn != "") {
    newFilter = new WebGridFilter()
    newFilter.ColumnMember = "btn"
    newFilter.FilterType = oMyObject.btnFilterType;
    newFilter.FilterText = oMyObject.btn
    grid.RootTable.FilteredColumns.Add(newFilter);
    grid.RootTable.UpdateUI();
}

if (oMyObject.invoicedate != "") {
    newFilter = new WebGridFilter()
    newFilter.ColumnMember = "invoice_date"
    newFilter.FilterType = oMyObject.invoicedateFilterType;
    newFilter.FilterText = oMyObject.invoicedate
    grid.RootTable.FilteredColumns.Add(newFilter);
    grid.RootTable.UpdateUI();
}

grid.Refresh();

 

This code works. The problem is that if you attempt to click on the filter icon on the filter row, you get a script error exception saying something to the effect of:

 

'undefined' is null or not an object

 The URL listed is http://localhost/AnchorPoint/ISRes.axd?G/WebGrid_Context.js/707200403

 

If I click on any of the other non-filtered columns, I get the standard list of filtering options. I just want to filter the grid but still keep the filtering options for each column if the user needs to change them...

All times are GMT -5. The time now is 5:57 AM.
Previous Next