Reputation: 204
Simple question but I'm not sure about the answer. Basically I know that if you are dynamically/lazy loading pages with AJAX then you cannot use dataview.
However I have built a lot of functionality with a prototype that uses dataview and I'd like to use it with a real database connection (right now it's all fake data from a for loop). Is it possible to load all of my data onto the client machine from a database and then use the dataview to do all of my sorting etc?
Upvotes: 0
Views: 2240
Reputation: 5621
The data for the dataView is a JS array. It can also be a JSON array. How you load that array is up to you. I would personally use AJAX ($.get maybe) to populate this array and set this in the dataView. Fetch full array on load or on submit using AJAX and then set this array in the dataView. The AJAX controller (which can support any framework you might be using - Struts/SpringMVC/GWT/etc) can be used to fetch from your database and format this array for you. The data can also be converted to a standard JSON format using libraries like Jackson.
I have personally used a jQuery-SlickGrid-JSON-SpringMVC model - and I think all these work very well together. Take a look at this wonderful tutorial if you want to go this route: http://krams915.blogspot.com/2011/01/spring-mvc-3-and-jquery-integration.html
Reiterating the point here though - the data in the SlickGrid can be loaded using a JSON array - which can populated in any way you prefer.
Hope this helps!
Upvotes: 1