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

Refresh of previously opened MVVM Grid filter dialog values not happening after Datasource.read()

7 Answers 160 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Development
Top achievements
Rank 1
Development asked on 22 Jan 2018, 07:48 PM
We have an MVVM read-only grid setup using Kendo UI version 2017.3.913 and is populated using a kendo datasource with a custom transport.read() function.

The grid is loaded for the first time and when a filter dialog is opened for a column you can see the appropriate checkbox values from the datasource's dataset.

However, if the datasource changes (and has new/changed/deleted values) and is re-read (ie. datasource.read()), if you click on the same column's filter, it will open a dialog with checkbox values from the original datasource dataset and not checkbox values from the new dataset. Any updates to the datasource (new/deleted values) are not reflected in the filter dialog checkbox value options. It looks as though the filter dialog gets populated from the datasource only on the initial time it is opened, and not after subsequent reads/refreshes of the datasource.

That seems like strange behavior.

As a workaround we could call a datasource.read() and then a grid.setDataSource(datasource), but that seems to be inefficient because you have to redraw the grid values twice, and it seems like it goes against the MVVM strategy.

Is there a way to call something to reinitialize the filter dialogs after a datasource.read() so we don't have to call a setDataSource() to force the filter dialogs to be refreshed when opened after a datasource.read()?

Or maybe this is resolved by a newer version of Kendo? It looks like the new version release on January 17th 2018 (2018.1.117) seems to have an enhancement related to the "DataSource component should be able to dynamically change and update the widget", but I don't know if that is applicable.

https://github.com/telerik/kendo-ui-core/issues/3674

?If any guidance can be provided that would be greatly appreciated! thanks!

7 Answers, 1 is accepted

Sort by
0
Development
Top achievements
Rank 1
answered on 22 Jan 2018, 09:20 PM

After looking at the source code, a quick solution might be to call the internal grid function _filterable(), but I don't see a way to actually call it since it is internal.

Why doesn't the datasource.read() already perform something like _filterable().

Thanks

0
Development
Top achievements
Rank 1
answered on 22 Jan 2018, 10:37 PM
welp, looks like I can call it and so far appears to work as expected:
grid.data("kendoGrid")._filterable()
Although it does clear the filter's "search" value but that is not a big deal at all.
Besides the fact that we probably aren't supposed to use it, are there any other reasons not to use it that I may not be understanding?
0
Preslav
Telerik team
answered on 24 Jan 2018, 12:13 PM
Hello,

Calling internal functions is okay if they fit your project requirements. However, have in mind that they are not documented and if we change their logic or name in a future release, we are not going to announce it in the release notes. Thus, your project might hit a breaking change/regression.

Having said that, please test the project thoroughly after updating the Kendo UI version in the future.


Regards,
Preslav
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Development
Top achievements
Rank 1
answered on 25 Jan 2018, 10:13 PM

Thanks Preslav.

 

Besides _filtertable() or grid.setDataSource(), are there any other options to reset/clear the state of the filter dialog windows after datasource.read()?

0
Preslav
Telerik team
answered on 26 Jan 2018, 11:14 AM
Hi,

Another possible solution could be refreshing the "checkSource" of the "FilterMultiCheck" widget. For example, check the approach outlined in this answer:

Regards,
Preslav
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Development
Top achievements
Rank 1
answered on 30 Jan 2018, 12:22 AM

Thanks Preslav. We'll keep that in mind in case _filterable() doesn't work out.

 

How do I make an official enhancement request so a grid performs the _filterable() or something comparable when using MVVM and doing a grid datasource refresh? That sounds like something where a new flag (defaulted to false or something to maintain current compatibility) could be incorporated pretty easily.

0
Preslav
Telerik team
answered on 30 Jan 2018, 03:33 PM
Hi,

You can submit a request at our feedback portal:
Most voted suggestions will be considered for implementation.

Regards,
Preslav
Progress Telerik
Try our brand new, jQuery-free Angular 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
Development
Top achievements
Rank 1
Answers by
Development
Top achievements
Rank 1
Preslav
Telerik team
Share this question
or