Title: Reference class Post by: evaj on October 02, 2012, 06:36:09 AM Hello,
I'm trying to reference some components by one class I have specified This is my source code: <div id="content" region="center" title="Language" style="padding:5px;"> <div id="win1" class="easyui-window a"> <table id="dg1"></table> </div> <div id="win2" class="a"> <table id="dg2"></table> </div> <div id="win3"> <table id="dg3"></table> </div> </div> var dgs = $('[id*=dg]'); var winw = $('[id*=win]'); //this line is ok when no class is specified in a div tag <div id="win2" ><table id="dg2"></table></div> var winw = $('.a'); //this line don't work as expected $(document).ready(function(){ dgs.datagrid({ columns:[[ {field:'code',title:'Code',width:100}, {field:'name',title:'Name',width:100}, {field:'price',title:'Price',width:100,align:'right'} ]] }); winw.window({ width: '600', height: '400', inline: true, onResize: function(width, height){ console.log(width, height, this); $(this).find('[id*=dg]').datagrid({ fitColumns: true }); }, onMove: function(left, top){ console.log("Move: ", left, top, this); var bound = $(this).parent().parent().position(); if(left<bound.left || top<bound.top){ $(this).window({ top: bound.top, left: bound.left }); } } }); }); Regards and Thanks Title: Re: Reference class Post by: stworthy on October 02, 2012, 06:14:59 PM var winw = $('[id*=win]');
var winw = $('.a'); The two statements above have different result. Notice your third div element definition: <div id="win3"> ... </div> Is it missing class="a"? If so, add class="a" to this element. |