Author Topic: 2 type editor in 1 column  (Read 2256 times)

atmaneuler

  • Pro Ultimate
  • Newbie
  • *
  • Posts: 33
    • View Profile
2 type editor in 1 column
« 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?

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6309
    • View Profile
Re: 2 type editor in 1 column
« Reply #1 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

atmaneuler

  • Pro Ultimate
  • Newbie
  • *
  • Posts: 33
    • View Profile
Re: 2 type editor in 1 column
« Reply #2 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

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6309
    • View Profile
Re: 2 type editor in 1 column
« Reply #3 on: April 23, 2021, 10:32:49 am »
Code: [Select]
editor: {
  options: ['yes', 'no' ]
}

atmaneuler

  • Pro Ultimate
  • Newbie
  • *
  • Posts: 33
    • View Profile
Re: 2 type editor in 1 column
« Reply #4 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...
« Last Edit: April 23, 2021, 11:06:30 am by atmaneuler »

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6309
    • View Profile
Re: 2 type editor in 1 column
« Reply #5 on: April 26, 2021, 10:19:23 am »
dataType can't be 'date' for such column.

Please remove / comment dataType: 'date'