views:

338

answers:

1

This is NOT a Master/Detail question.

I am using ASP.Net MVC and trying to display several jqGrids on the same page from different data sources in a tabbed interface.

However, when the page loads each jqGrid has the layout and data for the last jqGrid that is defined on the page. Is it possible to have two unrelated jqGrids on the same view/page?

When I load each jqGrid separately, the data displays in each one, as it should. However, when loading all at once, it does what I said earlier.

A: 

This should be possible. What do you mean by "load separately" - how do you load "not separately"? Can you show a bit of code? Do you use different IDs for corresponding grid's HTML elements?

queen3
Thanks for responding. Your question, "Do you use different IDs for corresponding grid's HTML elements?" forced me to delve deeper and I figured out the issue.The HTML elements did all have unique IDs. However, I was using Craig Stuntz' demo and didn't realize that he was declaring the variable in the defaults file for the grid. (Site.Master.js) so each partial view was using the same variable.Hence, the reason, each grid looked the same.I removed the reference to the defaults file and created each grid independently without use of that file and it now works.
L A Johnson
Glad I helped. Don't know what are those defaults that you use; I personally use a simple JS helper function so that I call createJqGrid(model, url) and all the defaults are there, with the ability to override (source code available at http://sprokhorenko.blogspot.com/2009/12/dedicated-to-my-wife.html).
queen3