We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Column with checkbox don't update the datasource

Thread ID:

Created:

Updated:

Platform:

Replies:

142049 Jan 16,2019 03:21 PM UTC Jan 21,2019 12:00 PM UTC ASP.NET MVC 5
loading
Tags: TreeGrid
Cholet
Asked On January 16, 2019 03:35 PM UTC

hi

I create a TreeGrid with a boolean column who appear with a checkbox

@(Html.EJ().TreeGrid("TreeGridSallesAttentes")
      .Columns(co =>
                {
                    co.Field("colTree").HeaderText("").Width(10).Width(50).Add();
                    co.Field("ticket").HeaderText("ticket").Width(10).AllowEditing(true).EditType(TreeGridEditingType.Boolean).Add();
                })



but when I check my checkbox, the datasource was not update :



and the event "EndEdit" was not triggered

regards



Jayakumar Duraisamy [Syncfusion]
Replied On January 17, 2019 12:26 PM UTC

Hi Cholet, 
We have analyzed the reported query. We are unable to reproduce the reported issue. Hence, we have prepared the sample based on this. Kindly modify our sample based on your application along with the replication procedure.  
By using “booleanedit” the checkbox will be in disabled state and on editing we can check/uncheck the field. Kindly share us more information or required files/product version related to this query with us this would be helpful for us to serve you better 
We have prepared the sample in v16.4.0.42 for your reference. Please find the sample from below location 
Regards, 
Jayakumar D 


Cholet
Replied On January 17, 2019 03:12 PM UTC

I can reproduce the issue.

To can update my checkbox without double-click on the row,
I run this command after fill the treegrid :
$('.e-treegrid-chekboxcell').prop("disabled", false);

And after running this command, update the checkbox do not triggered the event.

best regards



Jayakumar Duraisamy [Syncfusion]
Replied On January 18, 2019 11:08 AM UTC

Hi Cholet, 
As per our current behavior, we have rendered checkbox column on EditType as “TreeGridEditingType.Boolean” and it is possible to perform check/uncheck action only on TreeGrid edited cell state.  But, we can achieve your requirement by using column template support to render checkbox in JsRender template and update the respectively record value on change event. 
Please find the code example below: 
  <script type="text/x-jsrender" id="customColumnTemplate"> 
        <div style='padding-left:5px;'>{{if Approved}}<input type="checkbox" class="customCheckbox" checked>{{else}}<input type="checkbox" class="customCheckbox" />{{/if}}</div> 
    </script> 
@(Html.EJ().TreeGrid("TreeGridContainer") 
.Columns(co => 
         {      
           //..        co.Field("Approved").HeaderText("Approved").IsTemplateColumn(true).TemplateID("customColumnTemplate").EditType(TreeGridEditingType.Boolean).Width(30).Add();              
         }) 
         ) 
<script> 
        $("#TreeGridContainer").on("change", ".customCheckbox", function (e) {            
            var $tr = $(e.target).closest('tr'), 
                treeObj = $("#TreeGridContainer").data("ejTreeGrid"), 
                checkStatus = $(e.target).is(':checked'), 
                rowIndex = treeObj.getRows().index($tr), 
                record = treeObj.model.currentViewData && treeObj.model.currentViewData[rowIndex]; 
            //to update all the record collection 
            record.Approved = record.item.Approved = checkStatus; 
        }); 
    </script> 
 
We have also prepared the sample based on this, please find the sample from below location 
 
Please let us know if you need any further assistance. 
Regards, 
Jayakumar D 


Cholet
Replied On January 18, 2019 03:09 PM UTC

It works fine

thanks

Punniyamoorthi Elangovan [Syncfusion]
Replied On January 21, 2019 12:00 PM UTC

 Hi Cholet,  
Thank you for your update  
Please let us know if you require further assistance on this.  
Regards,  
Punniyamoorthi  
 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon