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

ClientDetailTemplateId- Editing the Each cell

1 Answer 209 Views
Grid
This is a migrated thread and some comments may be shown as answers.
SAJID
Top achievements
Rank 1
SAJID asked on 18 May 2013, 04:50 PM
In the main grid , I have specified the ClientDetailTemplateId("Temptemplate")

<script id="Temptemplate" type="text/kendo-tmpl">

                    @(Html.Kendo().Grid<NIMROD.Models.Test>()
                        .Name("Testid#")
                        .Columns(columns =>
                        {
                            columns.Bound(o => o.test1).Title("Test");
                            columns.Bound(o => o.test1Qty).HtmlAttributes(new { style = "text-align:right" });
                            columns.Bound(o => o.test2Qty).HtmlAttributes(new { style = "text-align:right" });
                           
                        })

                         .Editable(ed => ed.Mode(GridEditMode.InCell))
                         .Selectable(sel => sel.Mode(GridSelectionMode.Single))                       
                         .Events(ev =>{
                                         ev.Edit("edit");    
                                      })
                         .DataSource(dataSource => dataSource
                                    .Ajax()
                                    .Batch(true)
                                    .Read(read => read.Action("details", "Order"))
                                    .Update("UKEditPhaseReviewDrops", "Order")
                                    .Model(model => { model.Id(p => p.id); })
                                    .Events(ev => {
                                                   ev.RequestEnd("oncomplete");   
                                                   ev.Error("error_handler");  } )
                                    )
                                     .Events(ev =>{
                                         ev.Edit("onPhaseReviewedit");    
                                      })
                         
                         .Events(ev => ev.Save("onsave"))
                         .ToClientTemplate())    
</script>


Our requirement test1qty & test2qty cell should be editable or readonly based on condition .
Validation should be done for each cell by calling the action result ,Validation message should be displayed as javascript alert

Thanks In Advance

1 Answer, 1 is accepted

Sort by
0
Petur Subev
Telerik team
answered on 22 May 2013, 06:37 AM
Hello Sajid,

I am afraid that such editable dependency could not be created with the wrappers. What you can try is to use the Web (pure JavaScript version) and initialize your Grid inside of the detailInit event.
This way you can create conditions when configuring your detail template based on the Model of the parent row.

Take a look at this example:

http://demos.kendoui.com/web/grid/hierarchy.html

To make a field read only you need to specify it through the schema.model options (check the example from the documentation)

http://docs.kendoui.com/api/framework/datasource#configuration-schema.model


Kind Regards,
Petur Subev
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
Grid
Asked by
SAJID
Top achievements
Rank 1
Answers by
Petur Subev
Telerik team
Share this question
or