EasyUI Forum
April 27, 2024, 02:29:05 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: Reference class  (Read 7675 times)
evaj
Newbie
*
Posts: 13


View Profile Email
« 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
Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #1 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.

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!