Title: datagrid - column appearance regarding parameter Post by: jaimi 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 } Title: Re: datagrid - column appearance regarding parameter Post by: stworthy on August 15, 2017, 11:40:28 PM You can set the 'showHeader' property to display or hide the column header.
Title: Re: datagrid - column appearance regarding parameter Post by: jaimi on August 16, 2017, 11:16:23 PM could you please give me a brief example regarding on my snippet. Thanks.
Title: Re: datagrid - column appearance regarding parameter Post by: Coder on December 28, 2021, 04:50:20 PM $('#dg').datagrid('showColumn','Field');
$('#dg').datagrid('hideColumn','Field'); |