Checkbox column in PivotView

I have a boolean column in a JSON datasource bound to a SfPivotView. I would like to display that column as a checkbox column, and use that column as a way to select the row(s). How do add that column to the PivotViewValues collection (that is, in a PivotViewValue tag), and enable it as a row-selection mechanism?

I have attached the json file and the razor file.

Thanks.


Attachment: PivotView_CheckBox_Column_51a57d8c.zip

5 Replies 1 reply marked as answer

SS Saranya Sivan Syncfusion Team May 7, 2021 04:42 PM UTC

Hi Tom, 
 
We are preparing a workaround sample to achieve your requirement. This will be available in two business days. 
 
We appreciate your patience until then. 
 
Regards, 
Saranya S. 



SS Saranya Sivan Syncfusion Team May 11, 2021 04:12 PM UTC

 
Hi Tom, 
 
We have prepared a work around sample where one of the column has check box in its value cells and its checked state will be applied depends on its raw data. And we have made one source level changes to make it work. This will be included in Vol 1 SP1 release which is estimated to be rolled out in this week. So, we will send you the sample once Vol 1 SP1 release is rolled out. 
 
And, restricting row selection for particular row based on checked state couldn’t be achievable because of framework difficulties. 
 
Regards,
Saranya S.
 
 



SS Saranya Sivan Syncfusion Team May 13, 2021 12:47 PM UTC

 
Hi Tom,  
 
We are glad to announce that our Essential Studio 2021 Volume 1 Service pack v19.1.0.63 is rolled out where the reported source level changes have been included to make your requirement workable. It is available for download under the following link. 
 
Kindly find the work around sample in the following link, 
 
 
In the above sample, checked state of check boxes in value cells set based on its raw data. And to get the raw data kindly enable DrillThrough feature by enabling the property AllowDrillThrough. And if you don’t want to show the drill through dialog while double click the value cell, then kindly set the property Cancel as “true” in DrillThrough event. Kindly follow the code example for your reference. 
 
Code Snippet:  
   
   private void drillThrough(DrillThroughEventArgs args) 
    { 
        args.Cancel = true; 
  
    } 
     
Please let us know if you have any concerns.  
   
Regards,  
Saranya Sivan.  
 


Marked as answer

TO Tom May 14, 2021 08:22 AM UTC

Thanks for this. I am now trying to get the value from the checkbox when a user clicks on it. I thought the CellClick event would do the trick, but in the handler, the cell value always comes back as 1

<PivotViewEvents TValue="PoolsInEpochs" DrillThrough="drillThrough" CellClick="cellClick"></PivotViewEvents>


MM Manikandan Murugesan Syncfusion Team May 17, 2021 12:30 PM UTC

Hi Tom, 

Kindly use the native event “onchange” of checkbox to get its value. Please refer the following code example and sample. 

Code Example: 
<input type="checkbox" name="vehicle" value="Car" checked="@Selected" @onchange="onChange"> 
 
private void onChange(Microsoft.AspNetCore.Components.ChangeEventArgs args) 
    { 
        Console.WriteLine(args.Value); 
    } 
 


Please let us know if you have any other queries. 

Thanks, 
Manikandan 


Loader.
Up arrow icon