jQWidgets Forums
jQuery UI Widgets › Forums › Grid › Display column under condition
Tagged: jquery grid column
This topic contains 3 replies, has 2 voices, and was last updated by nico86 10 years, 12 months ago.
-
Author
-
hi,
I would like to display a grid, but I would like display a column (SOC in my example) under condition, is it possible
i try this with an if but doesn’t work…please help
... filtermode: 'excel', theme: 'metro', columns: [ { text: 'STUD_ID', datafield: 'STUD_ID', width: 40, editable: false }, { text: 'COUN_ID', datafield: 'COUN_ID', width: 40, editable: false }, { text: 'CENT_ID', datafield: 'CENT_ID', width: 40, editable: false }, { text: 'PATID_ID', datafield: 'PATID_ID', width: 50, editable: false }, { text: 'PATIDENT', datafield: 'PATIDENT', width: 110, editable: false }, { text: label_adr, datafield: 'ADRNBA', width: 50, editable: false }, { text: 'DISCOM', datafield: 'DISCOM', width: 280, editable: false}, { text: 'LLT', datafield: 'LLTLIST', width: 120, editable: false }, { text: 'PT', datafield: 'PTLIST', width: 120, editable: false }, if (indts == "MR_AE_16" ){ { text: 'SOC', datafield: 'SOC', width: 120, editable: false },
…etc
}
Hi nico86,
The columns property should be set to an Array of JSON objects which define the column settings as shown in the samples and documentation. It is not possible to add IF-Conditions inside an Array. If you want to display or hide a column, you may use the “showcolumn” and “hidecolumn” methods of jqxGrid.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.comThanks
it work but performance is very low because i have many columns to hide, is there any solutions ?function showhide_row(){ $("#jqxgrid").jqxGrid('hidecolumn', 'SOC'); $("#jqxgrid").jqxGrid('hidecolumn', 'PROCCOM'); $("#jqxgrid").jqxGrid('hidecolumn', 'MEDICNB'); $("#jqxgrid").jqxGrid('hidecolumn', 'TREATNAM'); $("#jqxgrid").jqxGrid('hidecolumn', 'DRUGCOD'); $("#jqxgrid").jqxGrid('hidecolumn', 'DRUGNAME'); $("#jqxgrid").jqxGrid('hidecolumn', 'DRUGLBL'); $("#jqxgrid").jqxGrid('hidecolumn', 'ATCCOD'); $("#jqxgrid").jqxGrid('hidecolumn', 'ATCLBL'); $("#jqxgrid").jqxGrid('hidecolumn', 'PLLTCOD'); $("#jqxgrid").jqxGrid('hidecolumn', 'PPTCOD'); /* if (indts=='MR_AE_17' ) { $("#jqxgrid").jqxGrid('showcolumn', 'SOC');} if (indts.substr(0,6)=='MR_AEP' ) {$("#jqxgrid").jqxGrid('showcolumn', 'PROCCOM');} if (indts=='MR_MH_03' || indts=='MR_MH_04' || indts=='MR_MH_05' ) {$("#jqxgrid").jqxGrid('showcolumn', 'PROCCOM');} if (indts=='MR_MH_06' ) { $("#jqxgrid").jqxGrid('showcolumn', 'MEDICNB');$("#jqxgrid").jqxGrid('showcolumn', 'TREATNAM');$("#jqxgrid").jqxGrid('showcolumn', 'DRUGCOD');} if (indts=='MR_MH_07' ) { $("#jqxgrid").jqxGrid('hidecolumn', 'ADRNBA');$("#jqxgrid").jqxGrid('hidecolumn', 'DISCOM');$("#jqxgrid").jqxGrid('showcolumn', 'ATCCOD') $("#jqxgrid").jqxGrid('showcolumn', 'MEDICNB');$("#jqxgrid").jqxGrid('showcolumn', 'TREATNAM');$("#jqxgrid").jqxGrid('showcolumn', 'DRUGCOD'); } if (indts=='MR_MH_08' || indts=='MR_MHP_01' || indts=='MR_MHP_02' ) { $("#jqxgrid").jqxGrid('showcolumn', 'PROCCOM');$("#jqxgrid").jqxGrid('showcolumn', 'PLLTCOD'); $("#jqxgrid").jqxGrid('showcolumn', 'PPTCOD'); } if (indts=='MR_TT_01' ) { $("#jqxgrid").jqxGrid('showcolumn', 'MEDICNB');$("#jqxgrid").jqxGrid('showcolumn', 'TREATNAM'); $("#jqxgrid").jqxGrid('showcolumn', 'ATCCOD'); $("#jqxgrid").jqxGrid('showcolumn', 'DRUGNAME');$("#jqxgrid").jqxGrid('showcolumn', 'DRUGLBL'); $("#jqxgrid").jqxGrid('showcolumn', 'ATCLBL'); $("#jqxgrid").jqxGrid('hidecolumn', 'ADRNBA');$("#jqxgrid").jqxGrid('hidecolumn', 'DISCOM'); $("#jqxgrid").jqxGrid('hidecolumn', 'LLTLIST');$("#jqxgrid").jqxGrid('hidecolumn', 'PTLIST'); }*/ }
Sorry it s ok now with
$(‘#jqxgrid’).jqxGrid(‘beginupdate’);
…
$(‘#jqxgrid’).jqxGrid(‘endupdate’);thanks
-
AuthorPosts
You must be logged in to reply to this topic.