EasyUI Forum
April 23, 2024, 07:23:59 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Grids within Tabs with the same ID  (Read 20410 times)
Onegin
Newbie
*
Posts: 11


View Profile
« on: July 12, 2011, 06:27:27 AM »

I am using tabs, each tab having a grid as its "content". How to avoid DOM conflicts if all the grids must have the same table ID.?
I use rather tricky loop, where I update all tabs content with ' ', except the selected one, but it does not work in Firefox 4 (grid does not show the data). It does however work in FF3.6...
Any idea?
Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #1 on: July 12, 2011, 06:59:49 PM »

Only one element may has a particular id. If two or more elements share the same id, then you cannot find the exactly element by id.
A better way is to set the class attribute to every grid, at later you can use the class selector to find them, just like this:

<table class="mytable easyui-datagrid"></table>

If you want to do some actions with the grid that displayed in selected tab panel, get the selected tab panel first and then find that grid:

Code:
var p = $('#tt').tabs('getSelected'); // get the selected tab panel
var g = p.find('table.mytable'); // get datagrid object
g.datagrid('reload'); // call datagrid method
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!