Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
765
Change DataSourceUrl in runtime
posted

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

Parents
  • 24671
    Suggested Answer
    posted

    Hi,

    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


Reply Children
No Data