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. Image for the cookie policy date

allow editting some columns

Hi,

I wonder if the treegrid in asp.net mvc has the feature allowing user edit some columns but not others.
Right now, user can edit every column in the treegrid, but we do not want them to edit some columns.
Thanks,

Harry

3 Replies

MK Mahalakshmi Karthikeyan Syncfusion Team July 20, 2015 09:49 AM UTC

Hi Harry,
For your kind information, we can cancel the editing for particular fields in TreeGrid with the help of “BeginEdit” client side event. Please refer the below code snippet to cancel the editing for particular column.

 


@ (Html.EJ ().TreeGrid ("TreeGridContainer").

       EditSettings(eve =>

       {

           eve.AllowEditing(true);

           eve.AllowAdding(true);

           eve.AllowDeleting(true);

           eve.EditMode(TreeGridEditMode.CellEditing);      

       }).

       ClientSideEvents(eve=>{

           eve.BeginEdit("beginEdit");

       }).

      //...

  )


<script type="text/javascript">

        function beginEdit(args) {

            var treeObj = $("#TreeGridContainer").data("ejTreeGrid");

            var columns = treeObj.model.columns;

//cancelling editing for 'StartDate' column and 'PercentDone' column

            if (columns[args.columnIndex].field == "StartDate" || columns[args.columnIndex].field == "PercentDone")

               args.cancel = true;

        }

    </script>



We have also prepared a sample prepared a sample based on this and you can find the sample under the following location

Sample: http://www.syncfusion.com/downloads/support/forum/119650/ze/CellEditing202526131

Also currently there is no support to cancel editing a row for editMode as “RowEditing”. We have also logged an improvement task to cancel editing the row  in “RowEditing” mode. 

A support incident has been created under your account to track the status of this requirement. Please log on to our support website to check for further updates.

https://www.syncfusion.com/account/login?ReturnUrl=/support/directtrac/incidents

Please let us know if you require further assistance on this.


Regards,

Mahalakshmi K.



HZ Harry Zheng July 20, 2015 02:29 PM UTC

Hi Mahalakshmi,

Thank you for your solution. It works well to limit the columns not allowed to edit.
I tried your sample by commenting out  "TreeGridToolBarItems.Edit" in ToolBarSettings (since we do not want user to edit row using edit in toolbar), it gives a webpage error when I try to edit a cell in "Duration" column.  Please see attached file for screenshots.
I wonder if this could be fixed.
Thank you,

Harry

Attachment: HZ20150720_dbf3953.rar


MK Mahalakshmi Karthikeyan Syncfusion Team July 21, 2015 12:50 PM UTC

Hi Harry,

Sorry for the inconvience caused.

We can also reproduce the issue while disabling edit icon in the toolbar and enabling the cellEditing in TreeGrid. A support incident has been created under your account to track the status of this issue report. Please log on to our support website to check for further updates.

https://www.syncfusion.com/account/login?ReturnUrl=/support/directtrac/incidents

Please let us know if you require further assistance on this.

Regards,

Mahalakshmi K.


Loader.
Live Chat Icon For mobile
Up arrow icon