Grid not loading with second query

4 posts, 1 answers
  1. Christopher
    Christopher avatar
    3 posts
    Member since:
    Apr 2017

    Posted 05 May Link to this post

    I have a grid that I am loading with a linq query to my database.  On page load it works great and returns dated now + 21 days.  The users need to ability to then enter there own dates to search between.  It is all working great right up to the point the data returned from the controller needs to get into the grid.  It just won't load.

    Relevent code of grid

    .DataSource(dataSource => dataSource
        .Ajax()
        .PageSize(20)
        .Read(read => read
            .Action("Action", "Controller")
            )
        .Sort(sort =>
        {
            sort.Add(p => p.ID).Ascending();
            sort.Add(p => p.Date).Ascending();
        })
        .Group(g =>
        {
            g.Add(c => c.ID);
        })
        .ServerOperation(false)
    )

     

    When the user enters 2 dates and clicks search the function is run.  The grid is cleared and a loading message appears goes away and the grid remains blank.

    function onClickSearch() {
        var fromDate = $("#startDate").data("kendoDatePicker").value(),
            toDate = $("#endDate").data("kendoDatePicker").value();
        $("#prodReadiGrid").data("kendoGrid").dataSource.read({ "start": fromDate, "end": toDate});
    }

     

    When I debug I see the controller sending the view the grid, it just does not load.

     

    Any ideas?

  2. Answer
    Georgi
    Admin
    Georgi avatar
    169 posts

    Posted 09 May Link to this post

    Hello Christopher,

    I apologize for the late reply.

    I used the configuration from your post and assembled a small sample. You can find it attached.

    The sample is working as expected on my end and the data in the Grid is retrieved as expected. Please give the sample a try and let me know how it works for you. 

    I would appreciate it if you can modify the sample in a way that the issue you are observing is replicated and send it back to us. This will enable us to examine the behavior locally and look for its cause.


    Regards,
    Georgi
    Telerik by Progress
    Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
  3. Christopher
    Christopher avatar
    3 posts
    Member since:
    Apr 2017

    Posted 28 Sep in reply to Georgi Link to this post

    Thank you for the response.  I know it has been several months but the clients requirements changed and this put off.  Now the requirement is back and the solution worked great,

    The problem I am having now is that once the results from the button search is shown any sorting or filiter returns to the original full data set since the datasource.read is run without the parameters.

    Is it possible to use the AjaxDataSourceBuilder? If so how?

    Or do I need to use the CustomDataSourceBuilder? And if so how?
  4. Georgi
    Admin
    Georgi avatar
    169 posts

    Posted 02 Oct Link to this post

    Hello Christopher,

    Based on the provided information I assume that the requirement is to persist filters of other columns when using the external filter. Please correct me if I am wrong.

    Possible solution is to get current filters using dataSource.filter method. Then modify only the filters from the external filter widget. Once the filters are modified apply them to the grid using dataSource.filter method.

    I have modified the sample from previous message to apply the aforementioned approach. Please give it a try and let me know if it works for you.


    Regards,
    Georgi
    Progress Telerik
    Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Back to Top