简体   繁体   中英

How to make only selected Columns editable in ShieldUI Grid?

I am using ShieldUI for making an editable Grid on a webpage. A very similar grid can be found at this URL .

My requirement is to make only 1 column editable while keeping the remaining columns as non-editable in the above Grid.

The Documentation of the ShieldUI provides option to enable or disable editing of the whole Grid at a time. However, it provides no option to enable or disable editing at column level.

I could not find any good resource on the web on this topic.

As a possible solution, we can enforce the edit disable using Javascript, but I think that would destroy its simplicity.

How can we achieve this? Any help would be highly appreciated.

Thanks

I was having a similar problem, I used the editorCreating event to enable/disable the default control behavior. I am using row editing in this example.

https://www.shieldui.com/documentation/grid/javascript/api/events/editor-creating

Ex.

events: {
     editorCreating: function(e) {
        if (e.field == "column_i_want_to_disable") {
            e.options = { enabled: false };
         }
    },

You should be able to cancel the editing on a row by overriding the command event, described here: https://www.shieldui.com/documentation/grid/javascript/api/events/command

Before a row goes in editing mode, an "edit" command is sent, which can be caught by the command event described above.

Inside the event handler you can inspect the row being edited and cancel the editing it if needed.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM