EasyUI Forum
May 09, 2024, 07:33:31 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Tabs + datagrids  (Read 6506 times)
Rimokas
Newbie
*
Posts: 12


View Profile Email
« on: August 27, 2015, 01:07:19 AM »

Hi,

Can't find how to add ( rend ) dinamically datagrids to tabs ... Sad

I'm creating tabs from structure :

Code:
            for ( var p in ptbs )
            {
               var str = "<table id='dg'" + p.toString() + " class='easyui-datagrid' style='width:600px;height:500px'></table>";
               $( '#pTab').tabs( 'add',
               {
                  id      : 'tab' + p.toString(),
                  title   : ptbs[ p ][ "pav_" + $app_lng ],
                  closable: false,
                  fit     : true,
                  selected: ( p == 0 ? true : false ),
                  content : str
               });
            }   


And then want to add datagrids from structures :

Code:
         for ( var p in ptbs )
         {
            debugger;
            //var page = $( '#pTab' ).tabs( 'getTab', p );
            dobj[ p ] = $( '#dg' + p.toString() ).datagrid( grd_cfg[ p ].create_grid() );
         }

Structures of datagrids are goods - I checked them in a single page, each datagrid appears and works fine ...

Simply I don't know how it to add to tabs ...

Thanks in advance ...
Logged
Rimokas
Newbie
*
Posts: 12


View Profile Email
« Reply #1 on: August 27, 2015, 05:28:45 AM »

Find the solution, after reviewing samples ...

Simply format needfull html tags ...

Code:
         if ( ptbs.length > 1 )
         {
            $( 'body' ).append( '<div id="pTab">' );
            $( "#pTab" ).addClass( 'easyui-tabs' );
           
            for ( var p in ptbs )
            {
               var nm = "tab" + p.toString();
               var nd = "dg"  + p.toString();
               $( "<div id='" + nm + "' title='" + ptbs[ p ][ "pav_" + $app_lng ] + "'></div>").appendTo( "#pTab" );
               $( "<table id='" + nd + "'></table>").appendTo( "#" + nm );
               $( '#' + nd ).addClass( 'easyui-datagrid' );
            }
           
            $( '#pTab' ).tabs(
            {
               border  : true,
               fit     : true,
               plain   : true,
               onSelect: function( title, index )
               {

then that works :

Code:
         for ( var p in ptbs )
         {
            dobj[ p ] = $( '#dg' + p.toString() ).datagrid( grd_cfg[ p ].create_grid() ); //
            dobj[ p ].datagrid( 'enableCellEditing' );
            dobj[ p ].datagrid( 'enableFilter'      );
            //dobj[ p ].datagrid( 'columnMoving' );
         }

Thanks ! Smiley
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!