May 24, 2014, 1:51 AM
[CLOSED] Filterheader and getRowsValues
Hi,
I have a grid panel that uses the FilterHeader plugin to allow filtering in the header.
When the user clicks on the Save button, I want to save the contents of this grid to the database. However the filters are creating a problem.
And this is how:
If the user has entered a text in one of the header filters, and the grid shows only filtered rows then even if I clear the filters before saving (using a Direct Method) getRowsValues() gives me the filtered records. I don't just want the filtered records, I want all records.
Please delete/close - I have already solved this issue. Thanks
I try to clear the filters in the Before event handler and I see it get cleared on the UI but when it calls the Controller, I only see the filtered records.
There should be an ignoreFilters config on getRowsValues().
Do you know of a way to get around this?
My Direct Events code
I have a grid panel that uses the FilterHeader plugin to allow filtering in the header.
When the user clicks on the Save button, I want to save the contents of this grid to the database. However the filters are creating a problem.
And this is how:
If the user has entered a text in one of the header filters, and the grid shows only filtered rows then even if I clear the filters before saving (using a Direct Method) getRowsValues() gives me the filtered records. I don't just want the filtered records, I want all records.
Please delete/close - I have already solved this issue. Thanks
I try to clear the filters in the Before event handler and I see it get cleared on the UI but when it calls the Controller, I only see the filtered records.
There should be an ignoreFilters config on getRowsValues().
Do you know of a way to get around this?
My Direct Events code
.DirectEvents(de =>
{
de.Click.EventMask.ShowMask = true;
de.Click.EventMask.Msg = "Saving Changes...";
de.Click.Url = Url.Action("SaveUser", "Admin");
de.Click.CleanRequest = true;
de.Click.Method = HttpMethod.POST;
de.Click.Before = "return SPARTA.UserAdmin.clearFilters()";
de.Click.ExtraParams.Add(new Parameter("selUser", "SPARTA.UserAdmin.makeUserObject('" + userId + "', #{txtUAFirstName}.getRawValue(), #{txtUALastName}.getRawValue(), #{dpdUAAllCountries}.getValue(), #{chkUAActive}.getValue())", ParameterMode.Raw));
de.Click.ExtraParams.Add(new Parameter("selPermissions", "Ext.isDefined(Ext.getCmp('gpPermSelected')) ? Ext.encode(App.gpPermSelected.getRowsValues({selectedOnly : false, visibleOnly : false})) : '' ", ParameterMode.Raw));
de.Click.ExtraParams.Add(new Parameter("selCountries", "Ext.isDefined(Ext.getCmp('gpCountrySelected')) ? Ext.encode(App.gpCountrySelected.getRowsValues({selectedOnly : false, filterField : function (record, fieldName, value) { return fieldName == \"Id\"; }})) : '' ", ParameterMode.Raw));
de.Click.Failure = "SPARTA.Utils.showError('Oops', 'Sorry, we are unable to Save your changes because of an error.<p/>Error Details:<br/>' + result.errorMessage );";
de.Click.Success = "SPARTA.Utils.showSuccess('User changes were updated successfully!'); this.up('panel').up('window').close();";
}
)
My JS Code for Clearing the filterclearFilters: function () {
var pgrid = Ext.getCmp('gpPermSelected'),
cgrid = Ext.getCmp('gpCountrySelected');
if (Ext.isDefined(pgrid)) {
var pstore = pgrid.getStore();
pgrid.filterHeader.clearFilter();
}
return true;
},
Last edited by Daniil; May 26, 2014 at 5:53 AM.
Reason: [CLOSED]