This is a migrated thread and some comments may be shown as answers.

Grid not loading with second query

3 Answers 19 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Christopher
Top achievements
Rank 1
Christopher asked on 05 May 2017, 05:14 AM

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?

3 Answers, 1 is accepted

Sort by
0
Accepted
Georgi
Telerik team
answered on 09 May 2017, 11:28 AM
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.
0
Christopher
Top achievements
Rank 1
answered on 28 Sep 2017, 06:19 AM
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?
0
Georgi
Telerik team
answered on 02 Oct 2017, 06:49 AM
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.
Tags
Grid
Asked by
Christopher
Top achievements
Rank 1
Answers by
Georgi
Telerik team
Christopher
Top achievements
Rank 1
Share this question
or