ParamQuery grid support forum

General Category => Help for ParamQuery Pro => Topic started by: conx on May 11, 2020, 09:47:56 am

Title: Dynamically change the dataType of the column after adding new column???
Post by: conx on May 11, 2020, 09:47:56 am
I added a new column which is on string by default, so I need to change one of the columns to date format and other to the integer format from the front-end view, is there any functions on toolbar which can be used to dynamically change the data type of the column after its been created????
Title: Re: Dynamically change the dataType of the column after adding new column???
Post by: paramvir on May 11, 2020, 12:05:26 pm
Please use getColumn method to get column and change its properties.

https://paramquery.com/pro/api#method-getColumn

Code: [Select]
listener: function () {
   this.getColumn({dataIndx: dataIndx of field}).dataType = "integer";
}
Title: Re: Dynamically change the dataType of the column after adding new column???
Post by: conx on May 11, 2020, 01:09:58 pm
i got it, this code can be done from backend but in spreadsheet/worksheet how can i select the column and have options to change the datatypes?
Title: Re: Dynamically change the dataType of the column after adding new column???
Post by: paramvir on May 11, 2020, 03:53:13 pm
The above method is for changing dataType from toolbar and selected column's dataIndx or colIndx can be obtained from Selection().address() method.

https://paramquery.com/pro/api#method-Range

https://paramquery.com/pro/api#method-Selection

Alternatively it can also be done from context menu ( easier way ).

Code: [Select]
action: function (evt, ui) {        
ui.column.dataType = "integer";
}