PivotView selection does not stick

https://dev.getmerit.xyz/fe/#mp-tab-admin-segments


When I select a cell in Pivot it goes gray but then "unselects". It worked before - i am not sure what changed. I even removed cellSelected event function


dataSourceSettings: {
        type: 'CSV',
        expandAll: false,
        enableSorting: true,
        rows: [{ name: 'incomeamount_binned' }],
        columns: [{ name: 'state' }],
        values: [{ name: 'id' }],
        filters: [{ name: 'employmenttype' }],
        conditionalFormatSettings: [
            {
                measure: 'id', conditions: 'Between', value1: 0, value2: 5,
                style: {backgroundColor: '#f5b0a6'}
            },
            {
                measure: 'id', value1: 25, conditions: 'GreaterThan',
                style: {backgroundColor: '#9fd6ad'}
            }
        ]
    },
    allowDrillThrough: true,
    showGroupingBar: true,
    showFieldList: true,
    allowConditionalFormatting: true,
    drillThrough: onDrillThrough,
    //cellSelected: onCellSelectedPivot,
    gridSettings: {
        allowSelection: true,
        selectionSettings: { mode: 'Cell', type: 'Multiple' }
    },
    height: 780

4 Replies

AL Alex Lyashok November 26, 2022 05:04 PM UTC

Actually the issue is that another component refreshes the pivot on click - sidebar.

How do i add an event to Sidebar that fires only once when it closes?



RG Rajeshkannah G Syncfusion Team November 28, 2022 01:24 PM UTC


Hi Alex,


From the explanation, we understand that you want an event that would be triggered while closing the Sidebar component. In the Sidebar component, we have a close event that will trigger each time Sidebar gets closed.


Check the following API property:

https://ej2.syncfusion.com/documentation/api/sidebar/#close


We've included a sample with the Sidebar close event for your reference.


https://stackblitz.com/edit/c3vpd8?file=index.html,index.ts


Check out the shared details. If we misunderstood, please provide more information about the exact problem you're experiencing at your end, including code snippets.


Regards,

Rajeshkannah G



AL Alex Lyashok November 28, 2022 01:54 PM UTC

My sidebar also has close on document click property, so close triggers every click....



IL Indhumathy Loganathan Syncfusion Team November 29, 2022 02:37 PM UTC

Alex, The close event of the Sidebar will trigger each time the component gets closed. Since you enabled the closeOnDocumentClick property, it will collapse the Sidebar on a click anywhere on the entire area. However, you can avoid this by preventing the Sidebar from closing on specific conditions by using the cancel argument within the close event. Check out the below code snippet.


function onClose(args): void {

  //Check whether the clicked item is a button or an icon.

  if (

    args.event != null &&

    (args.event.target.classList.contains('menu') ||

      args.event.target.innerText == 'TOGGLE')

  ) {

    //Cancel Sidebar closing.

    args.cancel = true;

  } else {

    alert('Close event is triggered.');

  }

}


Sample: https://stackblitz.com/edit/c3vpd8-oqqtk5?file=index.html,index.ts


Loader.
Up arrow icon