Forum

November 2nd, 2014
A A A
Avatar

Lost password?
Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

The forums are currently locked and only available for read only access
sp_Feed Topic RSS sp_TopicIcon
Promlem with multiply grids with same #id or without #id at all
25/11/2011
19:11
Avatar
millfreedom
Ukraine
New Member
Members
Forum Posts: 1
Member Since:
25/11/2011
sp_UserOfflineSmall Offline

e.g. I want to create 2 grids:

<div id="grid_one_area">

<table id="jqGridTable"></table>

</div>

<div id="grid_two_area">

<table id="jqGridTable"></table>

</div>

then I try to create it:

jQuery('#grid_one_area #jqGridTable').jqGrid({...some options...});

jQuery('#grid_two_area #jqGridTable').jqGrid({...some options...});

But, HEY!

Now second grid supersedes first!

OK, I try to change selectors:

<div id="grid_one_area">

<table class="jqGridTable"></table>

</div>

<div id="grid_two_area">

<table class="jqGridTable"></table>

</div>

Now, even first grid creation fails:

jQuery('#grid_one_area .jqGridTable').jqGrid({...some options...});

I think that is because jqGrid works incorrect with object's selector it was created from and try to figure out "id" of this object.

Plz, fix it or give advice to me, how can i use two or more grids WITH SAME identifiers (this is mandatory rule).

25/11/2011
19:27
Avatar
OlegK
Germany
Member
Members
Forum Posts: 1255
Member Since:
10/08/2009
sp_UserOfflineSmall Offline

Hello millfreedom,

You are definitifely wrong in the first example because you used the same id="jqGridTable" twice on one HTML page. The ids must be unique corresponds to HTML/XHTML specification.

The second example, with the usage of <table class="jqGridTable"></table>, is correct as HTML code, but it can't be used by jqGrid. The problem is that jqGrid require id attribute on the table element. The same requirements exists in some jQuery UI Widgets (the datepicker for example). You don't need to use the id in the selector which create jqGrid, but you have to include id attribute to the table elements. So you have to modify you code to the following

<div id="grid_one_area">
    <table id="t_one" class="jqGridTable"></table>
</div>
<div id="grid_two_area">
    <table id="t_two" class="jqGridTable"></table>
</div>

Then you can create jqGrid with the code like

jQuery('#grid_one_area .jqGridTable').jqGrid({…some options…});

or

jQuery('#t_one').jqGrid({…some options…});

Regards
Oleg

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

Currently Online:
41 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

OlegK: 1255

markw65: 179

kobruleht: 144

phicarre: 132

YamilBracho: 124

Renso: 118

Member Stats:

Guest Posters: 447

Members: 11373

Moderators: 2

Admins: 1

Forum Stats:

Groups: 1

Forums: 8

Topics: 10592

Posts: 31289

Newest Members:

, razia, Prankie, psky, praveen neelam, greg.valainis@pa-tech.com

Moderators: tony: 7721, Rumen[Trirand]: 81

Administrators: admin: 66

Comments are closed.
Privacy Policy   Terms and Conditions   Contact Information