This is a migrated thread and some comments may be shown as answers.

Grid popup edit mode to config all fields are readonly

2 Answers 52 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Allen
Top achievements
Rank 1
Veteran
Allen asked on 24 Mar 2021, 08:50 PM

I have a grid with Edit mode Popup code like below, this popup is good to add a new record. 

Is there a way I can have 'View Only' Command instead of 'Edit'  to show all data fields of a row in the popup?

I need it is because I need pull out more fields which are not in grid row.

 

 .Editable(editable => editable.Mode(GridEditMode.PopUp).TemplateName("ItemEdit").Window(w => w.Title("Edit Item").Width(800)))

Thanks.

2 Answers, 1 is accepted

Sort by
0
Allen
Top achievements
Rank 1
Veteran
answered on 26 Mar 2021, 02:32 PM

I figured it out.
Inside @(Html.Kendo().Grid<PositionItemViewModel>()  
add 
.Events(events => events.Edit("onPopup"))
Then add javascript code
 function onPopup(e){
        if (e.model.isNew() == false) {
            $("#ItemStem").attr("readonly", true);

    
        } 
}


0
Anton Mironov
Telerik team
answered on 29 Mar 2021, 11:03 AM

Hi Allen,

Thank you for sharing your approach with the community.

I confirm - this is the recommended approach to achieve the desired behavior.

If our assistance is needed for anything else, do not hesitate to contact me and the team.

 

Kind Regards,
Anton Mironov
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Tags
Grid
Asked by
Allen
Top achievements
Rank 1
Veteran
Answers by
Allen
Top achievements
Rank 1
Veteran
Anton Mironov
Telerik team
Share this question
or