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

Read method is called twice - not always

4 Answers 2258 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Shahar
Top achievements
Rank 1
Shahar asked on 23 Oct 2018, 12:46 PM

Hi

 

I have severals tabs on the tab strip, each ith its own grid.
When I build the grids from JS code I specify autobind = false.

On with my code, I'm doing a call to filter method on a grid to apply some filter when it loads
and a few lines afterward it calls to dataSource.read method.

When I check the network tab on the dev tools I see The current tab grid is calling twice to get the data,
and the other tabs grid call only once to fetch the data.

 

Why is this behavior?

Attached screenshots of the network tab showing what I mean.

If you need any more data let me know

 

Thanks

4 Answers, 1 is accepted

Sort by
0
Tsvetina
Telerik team
answered on 25 Oct 2018, 12:00 PM
Hi Shahar,

On an empty DataSource, the filter() method internally triggers a server read request, even if you do not have server filtering enabled. This being said, if you are calling grid.dataSource.filter(someExpression), you do not need to also call grid.dataSource.read() afterwards.
Do you observe any problems if you remove the grid.dataSource.read() call?

Regards,
Tsvetina
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Shahar
Top achievements
Rank 1
answered on 25 Oct 2018, 03:15 PM

Yes, I do experience some issues when I take out the call to read method.

I will check it on Sunday as I think I have an idea why.

I will get back to you on this

 

Thanks

0
Tsvetina
Telerik team
answered on 29 Oct 2018, 10:45 AM
Hi Shahar,

Did you locate the cause of the problem when removing the read() call? If not, you can share the actual code that you run, along with an explanation when/where this code is executed and a copy of the Grid declaration, just in case.

Regards,
Tsvetina
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Shahar
Top achievements
Rank 1
answered on 29 Oct 2018, 06:50 PM

Hi

 

This morning I implemented a fix which removed the double call.

I will have to wait for a few days to see if there are any side effects.

 

Thank you for your help

Tags
Grid
Asked by
Shahar
Top achievements
Rank 1
Answers by
Tsvetina
Telerik team
Shahar
Top achievements
Rank 1
Share this question
or