Hi,
i have 2 igDataPicker, and a igGrid, i'm using version 2011.2, MVC3, my question is, how I can change the DataSourceUrl in runtime, because I need to spend the entire table, just information filtered by the dates DatePicker.
And another question, Can i refresh my grid, without refreshing the entire page?
thanks in advance.
Regards
There are two ways to refresh (rebind) the grid without reloading the whole page:
1) by setting a dataSource , on the client, that's data which you already got from somewhere:
$("#grid").igGrid('option', 'dataSource', yourDataSourceObject);
2) By calling dataBind(), which will either rebind to the dataSource (if set locally), or call the url, if the data source is a url string:
$("#grid").igGrid('dataBind');
Before calling dataBind, you can always change the url:
$("#grid").igGrid('option', 'dataSource', 'your new data source URL');
By the way, if you want the data source / grid to take care of building the url for you, you can just add the filtering params by using the urlParamsEncoded event. Not sure if this will work with your setup, but it should, if you just need to change the filtering params:
$("#grid").data("igGrid").dataSource.settings.urlParamsEncoded = function (owner, params) {
params.filteringParams.$filter = params.filteringParams.$filter + "new params here or just replace $filter completely";
};
Let me know if this helps. Thanks,
Angel
please, i need this example, my sourde no work:
$(document).delegate("#gridTransferenciasEnviadas", "iggriddatabinding", function (evt, ui) { debugger; $("#gridTransferenciasEnviadas").data("igGrid").dataSource.settings.urlParamsEncoded = function (owner, params) { . . . // i get this data from html controls en my view: var parametros = "?pFechaInicio=" + fechaDesde + "&pFechaFinal=" + fechaHasta + "&pMontoDesde=" + montoDesde + "&pMontoHasta=" + montoHasta + "&pEntidadDestino=" + entidadDestino + "&pPaisDestino=" + pais + "&pEstados=" + estados + "&pMoneda=" + moneda + "&pReferenciaSINPE=" + referenciaSINPE + "&pIBANOrigen=" + ibanOrigen + "&pIBANDestino=" + ibanDestino + "&pIdOrigen=" + idOrigen + "&pIdDestino=" + idDestino + "&pReferenciaCanal=" + referenciaCanal; params.filteringParams.$filter = parametros; }; });
my problem is dataSource.settings.urlParamsEncoded no call
please help