Author Topic: Multiple select value in row  (Read 2320 times)

resolvecomputing

  • Pro Ultimate
  • Newbie
  • *
  • Posts: 40
    • View Profile
Multiple select value in row
« on: September 25, 2018, 04:09:59 pm »
I have 1 case with multiple select in row, and I tried create model for that Column like below:
Code: [Select]
{ title: tran('users'), dataType: "html", dataIndx: "users",
                    editor: {
                        type: "select",
                        attr: "multiple",
                        valueIndx: "user_name",
                        labelIndx: "user_name",
                        options: function() {
                            return usersList
                        },
                        listeners: 'change',
                        init: function(ui) {
                            ui.$editor.pqSelect({
                                bootstrap: { on: true } ,
                                checkbox: true,
                                radio: true,
                            });
                        }
                    }
                },
And it's working for choosing, but after I choose and comeback, selected value gone.
Can you help me, thanks!

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6309
    • View Profile
Re: Multiple select value in row
« Reply #1 on: September 25, 2018, 04:44:10 pm »
It should be listener: 'change'

resolvecomputing

  • Pro Ultimate
  • Newbie
  • *
  • Posts: 40
    • View Profile
Re: Multiple select value in row
« Reply #2 on: September 25, 2018, 04:46:57 pm »
I changed but selected value still gone.

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6309
    • View Profile
Re: Multiple select value in row
« Reply #3 on: September 26, 2018, 07:40:33 am »
Multi select value is an array of options which is seralized to a string when saved in a cell.

So restore the array from string and reassign it to the multi select list in the editor initialization function.

Code: [Select]
init: function (ui) {
        ui.$editor.val( (ui.cellData || "").split(",") ).pqSelect({
checkbox: true,
radio: true
});
},
« Last Edit: September 26, 2018, 12:28:59 pm by paramquery »

resolvecomputing

  • Pro Ultimate
  • Newbie
  • *
  • Posts: 40
    • View Profile
Re: Multiple select value in row
« Reply #4 on: September 26, 2018, 02:58:37 pm »
It's working now, thanks!