Author Topic: Optgroup in select  (Read 3488 times)

queensgambit9

  • Pro Ultimate
  • Sr. Member
  • *
  • Posts: 341
    • View Profile
Optgroup in select
« on: October 18, 2016, 02:23:25 pm »
I have a select in toolbar like this:

Code: [Select]
options: [{
 test: 'test',
 test2: 'test2',
 test3: 'test3',
 ...

How could I add optgroup to group test2 and test3?

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6264
    • View Profile
Re: Optgroup in select
« Reply #1 on: October 18, 2016, 09:34:12 pm »
It's done by groupIndx.

Please check the documentation: http://paramquery.com/pro/api#option-column-editor
« Last Edit: October 18, 2016, 09:45:03 pm by paramquery »

queensgambit9

  • Pro Ultimate
  • Sr. Member
  • *
  • Posts: 341
    • View Profile
Re: Optgroup in select
« Reply #2 on: October 19, 2016, 02:31:22 pm »
Thanks. Read the documentation but still can't get it right...
Not sure where exactly where to enter the groupIndx...and how do I set the label?
« Last Edit: October 19, 2016, 02:34:54 pm by queensgambit9 »

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6264
    • View Profile
Re: Optgroup in select
« Reply #3 on: October 20, 2016, 01:12:37 pm »
groupIndx is used in the filter dropdown in "Shipping Region" column in this example:

http://paramquery.com/pro/demos/filter_header_local

queensgambit9

  • Pro Ultimate
  • Sr. Member
  • *
  • Posts: 341
    • View Profile
Re: Optgroup in select
« Reply #4 on: October 20, 2016, 01:31:01 pm »
Thanks, but my select do not belong to any column (not a filter), its a standalone select in the toolbar with hardcoded select options which execute functions...does it make any difference?

Tried:

options: [
 {test: 'test', groupIndx: 'testgroup'},
 {test2: 'test2'},
 {test3: 'test3'},
 ...

but no success...
« Last Edit: October 20, 2016, 01:39:11 pm by queensgambit9 »

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6264
    • View Profile
Re: Optgroup in select
« Reply #5 on: October 20, 2016, 05:18:59 pm »
It hardly matters as the syntax of options and groupIndx is same in toolbar dropdown, editor dropdown and filter dropdown.

Suggest you to read documentation carefully and practise with the online examples and share a jsfiddle if you face any issues.
« Last Edit: October 20, 2016, 05:21:20 pm by paramquery »

queensgambit9

  • Pro Ultimate
  • Sr. Member
  • *
  • Posts: 341
    • View Profile
Re: Optgroup in select
« Reply #6 on: October 20, 2016, 08:46:29 pm »
Thanks, struggled a bit and then created a jsfiddle...
Like to group option 2 and 3 with optgroup...

http://jsfiddle.net/zsztzvbz/

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6264
    • View Profile
Re: Optgroup in select
« Reply #7 on: October 20, 2016, 09:53:23 pm »