ParamQuery grid support forum

General Category => Help for ParamQuery Pro => Topic started by: atmaneuler on April 20, 2021, 12:51:05 pm

Title: 2 type editor in 1 column
Post by: atmaneuler on April 20, 2021, 12:51:05 pm
- I have 1 column and 7 rows in that column, i want row 0, 1, 2, 3, 5, 6, 7 to be of type Text and row 4 to be of type Select.
How will I do it?
Title: Re: 2 type editor in 1 column
Post by: paramvir on April 20, 2021, 06:11:29 pm
conditional editor type can be defined by implementing column.editor.type callback

Code: [Select]
editor: {
    type: function (ui) {
        if (ui.rowIndx == 5) {
            return "select"
        }
        else {
            return "textarea";
        }
    },
    ...
}

Reference: https://paramquery.com/pro/api#option-column-editor
Title: Re: 2 type editor in 1 column
Post by: atmaneuler on April 23, 2021, 06:06:12 am
If I want selectbox has 2 options (YES and NO). How do I code? Help me, please
Title: Re: 2 type editor in 1 column
Post by: paramvir on April 23, 2021, 10:32:49 am
Code: [Select]
editor: {
  options: ['yes', 'no' ]
}
Title: Re: 2 type editor in 1 column
Post by: atmaneuler on April 23, 2021, 11:03:40 am
      {
        title: 'ACTUAL',
        dataIndx: 'actual',
        maxWidth: 76,
        minWidth: 76,
        dataType: 'date',
        format: 'yy.mm.dd',
        align: 'center',
        valign: 'center',
        sortable: false,
        styleHead: this.styleForHead(),
        style: this.styleCell(),
        editor: {
          type: function (ui) {
            if (ui.rowIndx == 5) {
                return "select"
            }
            else {
                return "textarea";
            }
          },
          options: ['YES', 'NO'],
        }
      },

Here is my code, it's not working...
Title: Re: 2 type editor in 1 column
Post by: paramvir on April 26, 2021, 10:19:23 am
dataType can't be 'date' for such column.

Please remove / comment dataType: 'date'