MultiRange Selection Programmatically in a PivotGrid

Posted by: georgekam96 on 29 January 2020, 10:48 pm EST

  • Posted 29 January 2020, 10:48 pm EST

    Greetings,

    We have a case in which we want to programmatically select multiple cell ranges on a PivotGrid. It seems that the

    select
    function only works with a single cell range. Any next selection overwrites the previous one.

    Is there a way to achieve the desired functionality via Wijmo’s API?

  • Posted 30 January 2020, 5:33 pm EST

    Hi,

    In the PivotGrid, Multiple CellRange can be selected by changing the SelectionMode same as FlexGrid.

    If you would like to the non continuous selection, please set the selectionMode to MultiRange. The different selected CellRanges can be get using the selectedRanges property.

    Please refer to the following documentation for different selection modes:

    https://www.grapecity.com/wijmo/api/enums/wijmo_grid.selectionmode.html

    Hope it helps!

    Regards,

    Manish Gupta

  • Posted 2 February 2020, 8:50 pm EST

    Greetings again,

    We want to select multiple cell ranges programmatically. Setting the

    selectionMode
    to
    MultiRange
    allows the user to select multiple non-continuous cell ranges, but even on this mode we cannot select multiple ranges by calling the
    select
    method.

    Please, take a look at the example in the following link: https://stackblitz.com/edit/angular-wijmo-playground-selection

    As you can see the

    selectionMode
    is set to
    MultiRange
    and the user can, in fact, select multiple non-continuous ranges. However, we still cannot select multiple ranges programmatically, because any new selection that is performed, essentially, overwrites the previous one.

  • Posted 3 February 2020, 4:23 pm EST

    Hi George,

    We have asked the dev team on this issue. The tracking id of the case is 419478. We will update you as soon as we will hear from them.

    Regards,

    Ashwin

  • Posted 11 February 2020, 9:56 pm EST

    Hi George,

    The devs have updated the FlexGrid by which we can set the selectedRanges property to an array of CellRange to achieve multiple selections using JS. This update will be added in the next release of Wijmo.

    In the meantime, you can use private property _selHdl to select multiple ranges. Please refer to the sample below:

    https://stackblitz.com/edit/angular-wijmo-playground-selection-wu8ern

    ~regards

  • Posted 20 February 2020, 10:37 pm EST

    Hi guys

    I am using Multi Range too, and the user can use checkboxes or ctrl + click to select rows.

    Is there a trigger for ctrl+click? Like this I don’t need to handle checkboxes and clicks, I could just trigger the existing method when the user uses the checkbox.

    Found what I think is an issue:

    • Select the 1st, 3th and 5th rows of a grid, mantain the selection and with the ctrl pressed, click on 1st, 3th and 5th again(in this order), now the selectedRanges will have 6 items, the getClipString will return 6 items and not 3
  • Posted 24 February 2020, 5:20 pm EST

    Hi Ricardo,

    To check whether the user has Ctrl + clicked on the grid, you will need to handle the click event on the hostElement of the FlexGrid. If the handler, the event data will provide whether the Ctrl key is pressed or not:

    
    grid.hostElement.addEventListener('click', function(e) {
      if(e.ctrlKey) {
        console.log('Ctrl + click');
      }
    });
    
    

    Regarding the row, this has been recognized as a bug and we have forwarded a report to the dev team. The internal tracking id of the case is 422315. We will update you as soon as this issue is fixed.

    ~regards

  • Posted 26 February 2020, 6:08 pm EST

    Hi Ricardo,

    Regarding case 422315, the issue has been fixed in the latest nightly build. You may verify the same using the sample link below:

    https://stackblitz.com/edit/js-zttft4

    Now, if you will Ctrl + Click the selected row, it will deselect that row.

    PS: Nightly builds have not passed through the QA cycle as all of our release builds do. Therefore, these builds are not suitable in a production environment.

    ~regards

  • Posted 26 February 2020, 8:41 pm EST

    Hello Ashwin,

    Thank you for the quickly reply, there is one more situation here, follow the steps bellow to reproduce.

    • Ctrl + click line 2
    • Ctrl + click line 4
    • Ctrl + click line 6
    • Ctrl + Shift + click line 2
    • Now if you call getClipString will receive 7 lines of data, the last step adds new a range from row index 1 to 4

    Final selectedRanges:

    
    [
       {"_row":1,"_col":0,"_row2":5,"_col2":5},
       {"_row":1,"_col":0,"_row2":1,"_col2":5},
       {"_row":3,"_col":0,"_row2":3,"_col2":5}
    ]
    
    

    Result of “getClipString(null, false, true)”

    
    Id Country Active Downloads Sales Expenses
    1 UK true 32,359 70,413.99 32,160.35
    2 UK true 9,023 76,119.55 13,897.23
    3 Italy true 5,626 45,115.54 29,850.35
    4 Germany true 173,490 63,762.70 31,049.53
    5 UK false 183,252 58,187.13 41,618.51
    1 UK true 32,359 70,413.99 32,160.35
    3 Italy true 5,626 45,115.54 29,850.35
    
    

    regards

  • Posted 27 February 2020, 3:01 pm EST

    Hi Ricardo,

    We have forwarded this issue to the dev team with internal tracking id 422816. We will update you as soon as this issue is fixed.

    ~regards

  • Posted 2 March 2020, 8:29 pm EST

    Hi Ricardo,

    Regarding case 422816, the issue has been fixed in the latest nightly build. You may verify the same using the sample link below:

    https://stackblitz.com/edit/js-cqwxvq

    PS: Nightly builds have not passed through the QA cycle as all of our release builds do. Therefore, these builds are not suitable in a production environment.

    ~regards

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels