ParamQuery grid support forum
General Category => Help for ParamQuery Pro => Topic started by: queensgambit9 on August 15, 2017, 01:20:01 pm
-
I set some columns to columnSelector using this:
var newColumn = ['newColumn1', 'newColumn2'];
$("select.columnSelector").val(newColumn);
Works fine...but I would like to to append these columns to already existing columns in the columnSelector...what would be the best approach for this?
-
var newColumn = ['newColumn1', 'newColumn2'];
var oldVal = $("select.columnSelector").val()
$("select.columnSelector").val( oldVal.concat( newColumn ) )
-
Thanks, works fine.
When I make updates to the columnSelector, is it possible to run the function that controls the visibility of the column based on if the checkbox is selected on not?
-
Now I'm not so clear on your question. Have you added the new columns to colModel or is it columnSelector alone?
BTW my previous code merely extends the selection of already existing options in a multiple select list, it doesn't add new options. I'm not sure how that works fine for you.
Please share the full context / objective of your use case and a jsfiddle if possible.
-
Sorry if a bit unclear.
I want the user to be able to choose layout from a dropdrown. It hides or show more columns and applies them on the initial setup.
http://jsfiddle.net/3rfy0xf9/4/
-
Please check this: http://jsfiddle.net/3rfy0xf9/5/
-
Thanks, works fine.
However, I would to take into consideration the initial state of hidden. If a column was hidden in initial state it still should be hidden after layout load.
Now all available columns seems to be used...
-
The different ways you want to do it are business rules, which is outside the scope of support. http://jsfiddle.net/3rfy0xf9/6/
The grid related point to understand is:
To update values ( visible colums ) in columnSelector, please use:
$("select.columnSelector").val( cols ).pqSelect('refreshData');
where cols is an array of dataIndx of visible columns.