EasyUI Forum
April 28, 2024, 05:56:53 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: datagrid - column appearance regarding parameter  (Read 6404 times)
jaimi
Full Member
***
Posts: 119


View Profile
« on: August 14, 2017, 10:35:44 PM »

Is there a way to show or hide columns within a datagrid depending on a parameter? How to do that?

In the following sample I want to deal with that depending on the value of variable vPAR

sample:
$(function(){

 var vPAR = $('#vPAR').val();
 //alert(vPAR);

 $('#edgFirma').edatagrid({
  title : 'Firma',
  iconCls:'icon-firma',
  width:'100%', 
  height:'auto',
  collapsible : 'true',

  columns:[[ 
    {field:'OLT20A004T_KEY',title:'MandantKey',width:130,sortable:'true',hidden:'true'} 
    ,{field:'OLT20A006T_KEY',title:'AdressKey' ,width:130,sortable:'true',hidden:'true'} // if vPAR == 1 the column should be shown
   ,{field:'OLT20A015T_KEY',title:'QuelleKey' ,width:130,sortable:'true',hidden:'true'}
   ,{field:'OLT00L001T_KEY',title:'LandKey'   ,width:130,sortable:'true',hidden:'true'}
   ,{field:'PMA_NAME',title:'Mandant',width:150,sortable:'true',hidden:'true'
     ,editor:{ type:'textbox'
              ,options:{ required:true
                     ,disabled:true
                     ,prompt:'Mandant...'
                     ,missingMessage: 'Geben Sie den Mandanten ein.'
                  }
          }//editor
   }
Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #1 on: August 15, 2017, 11:40:28 PM »

You can set the 'showHeader' property to display or hide the column header.
Logged
jaimi
Full Member
***
Posts: 119


View Profile
« Reply #2 on: August 16, 2017, 11:16:23 PM »

could you please give me a brief example regarding on my snippet. Thanks.
Logged
Coder
Jr. Member
**
Posts: 94


View Profile
« Reply #3 on: December 28, 2021, 04:50:20 PM »

$('#dg').datagrid('showColumn','Field');
$('#dg').datagrid('hideColumn','Field');
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!