I have one Kendo UI Grid in my view page (MVVM Concept). Bind the data from view model. When I reduce the page size.
Kendo UI grid change to Kendo UI Listview. See this image:
How can I do this?
I have one Kendo UI Grid in my view page (MVVM Concept). Bind the data from view model. When I reduce the page size.
Kendo UI grid change to Kendo UI Listview. See this image:
How can I do this?
Copyright © 2021 Jogjafile Inc.
Define one single DataSource for both Grid and ListView.
Then define both a
DIV
for the Grid and for the ListView:And initialize the Grid and the ListView:
Now, what you should do is display one or the other depending on the width:
Where CSS class
ob-hidden
is:Now, the only remaining question is invoke one or the other depending on the width. You can user jQuery
resize
event for detecting changes.So, enclose both ListView and Grid in a
DIV
withid
container:and define the
resize
handler as:IMPORTANT: Whatever you do for getting this same result, please, don't create and destroy the Grid and the ListView each time there is a
resize
. This a computationally expensive operation.See it in action here: http://jsfiddle.net/OnaBai/JYXzJ/3/