简体   繁体   中英

Telerik RadGrid: Show column only in edit mode?

I'd like to "hide" one column in my RadGrid and only have it show when I'm in edit mode. I tried just moving it into the edit item template, but that didn't work at all.

Any suggestions would be deeply appreciated!

Thank you!

Oy...

"Paul's Third Law of Asking For Help You will discover the obscure answer 5 minutes after giving up and asking for advice."

Turns out you set the column to "Display=False" but only if you are in popup or edit form mode, not inline.

Hope it helps someone else.

Even though you did answer this yourself I thought I'd write an answer to clarify some things.

You can set the default value of the EditColumn to be false, even in InPlace edit. However it makes it a lot more difficult to save edited data as the InPlace edit ( for simplicity ) requires the EditColumn to display the save or cancel items.

That being said, you can do it - however you need to use explicit CommandNames on the items:

Say you want to Update a row with the new values you have inserted in the InPlace edit. Then the confirm button's CommandName would HAVE to be " Update " to be picked up correctly.

All of this being said, it would be a lot simpler for you to keep the EditColumn intact even when in InPlace (editmode).

Or you could specify the EditTemplate for one column to widen the column, add the two buttons necessary to perform Update and Cancel as well as hiding the EditColumn so that multiple InPlaceEdits can't be performed at the same time. :)

I hope this helps someone, as I was stuck in a similar situation myself when I had to incorporate both InPlace and EditForms EditModes on a single RadGrid and knowing the above information made a WORLD of difference.

You can try this:

var agtype = $telerik.$(atCell).text().trim();

if(agtype == ""Guaranty""){{
       var masterTableView = sender.get_masterTableView();
       var columnIndex = masterTableView.getColumnByUniqueName(""Amount"").get_element().cellIndex;
       masterTableView.showColumn(columnIndex);
}}

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