Author Topic: not set groupoption  (Read 1825 times)

sshede

  • Pro Ultimate
  • Newbie
  • *
  • Posts: 41
    • View Profile
not set groupoption
« on: January 06, 2021, 07:13:18 pm »
when i try set groupoption by below code then working

grid.Group().option({
                dataIndx: ["FundShortName","CashAccount"]
});


but below code not working

var groupRowString='"FundShortName","CashAccount"';
grid.Group().option({
                dataIndx: [groupRowString]
});

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: not set groupoption
« Reply #1 on: January 07, 2021, 01:58:28 pm »
it's because your 2nd code is incorrect.

Correct one is

Code: [Select]
var groupRowString='FundShortName,CashAccount';
grid.Group().option({
                dataIndx: groupRowString.split(",")
});

sshede

  • Pro Ultimate
  • Newbie
  • *
  • Posts: 41
    • View Profile
I tryed your example but not working Group change by dropDown
« Reply #2 on: January 07, 2021, 03:31:17 pm »
I tryed your example but not working Group change by dropDown

I have below changes in your exmplae - "Row grouping".
 1) Add html part

<select id='pivotDropDown' >
                <option value="-1">Select Group</option>
                <option value="sport,athlete">View 1</option>
                <option value="Country,age">View 2</option>
            </select>

2) javascript

$("#pivotDropDown").change(function(){
            grid.Group().option({ dataIndx: [] });
            var GM = grid.option("groupModel");
            var groupOptionArr=$("#pivotDropDown").val()
            var groupRowArr=groupOptionArr.split(",");
            for(var i=0;i<groupRowArr.length;i++){
                GM.dataIndx.push(groupRowArr);
            }
            grid.refreshDataAndView()
        })

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: not set groupoption
« Reply #3 on: January 07, 2021, 08:46:17 pm »
Please correct your code

HTML:
Code: [Select]
<select id='pivotDropDown' >
    <option value="-1">Select Group</option>
    <option value="sport,athlete">View 1</option>
    <option value="country,age">View 2</option>
</select>

js:
Code: [Select]
$("#pivotDropDown").change(function(){
    var val = $(this).val();
    grid.Group().option({
dataIndx: val == -1? []: val.split(",")
    });
})
« Last Edit: January 07, 2021, 08:53:00 pm by paramvir »