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

Editable Mode InLine event lifecycle and triggers

1 Answer 270 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Paul
Top achievements
Rank 1
Paul asked on 20 Jun 2017, 09:26 PM

Looking to implement a combination of functionality while using the Grid in InLine mode. Thus far searches have not brought up directly applicable examples or details on the event lifecycles for the grid.

Is there anywhere that shows an event lifecycle for the Grid?

Looking to know what events are available to work with (Grid/javascript/JQuery all valid) for controlling what happens when a row enters into EditMode AND if a new row is Added (Which therefore is automatically opened into edit mode but no datasource command has fired yet.

The functionality looking to implement:

  1. Setting which cell in the row focus is set to when the row opens up int InLine edit mode
  2. Selecting all contents of cell clicked that is in the row in edit mode
  3. When a new row is added (Automatically opened); set the following column dropdown values to some defaults. This is so it is visually already selected for the user and they can still change it if need be.

Columns:

c.ForeignKey(vm => vm.LocationNumber, (System.Collections.IEnumerable)ViewData["LocationsList"], "LocationNumber", "Drop_Text").HtmlAttributes(new { onchange = "triggerDropChange(this);" }).Width(200).Hidden(Model.Locations_ColumnInitHidden); //Display UIHint in Dropdown through LocationsList ClientTemplate with just the LocationNumber value behind
                                                                                                                                                                                                                                                                //c.ForeignKey(vm => vm.State, (System.Collections.IEnumerable)ViewData["StateList"], "Value", "Text").Width(120);
c.Bound(vm => vm.State).HtmlAttributes(new { @class = "locationLinkedState" }).Width(80);

 

The Datasource Create command already can set a default value if left blank; though that would not matter to a user till they sent the row through by clicking on the row Update command. So the aim in 3. is to have the default already selected for the user.

 

Any information on the available event lifecycles and the implementation of the mentioned functionality will be greatly appreciated.

1 Answer, 1 is accepted

Sort by
0
Konstantin Dikov
Telerik team
answered on 22 Jun 2017, 02:28 PM
Hi Paul,

Although that we do not have an article listing the events lifecycle, the event that you need to handle for the requirements that you have is the "Edit" event. Information on this matter could be found in the following help topic:
Regarding the last question, you could set default value directly in the DataSource of the Grid for that particular column/field:
.DataSource(dataSource => dataSource
    .Ajax()
    .Batch(true)
    .Model(model =>
    {
        model.Id(p => p.ProductID);
        model.Field(p => p.ProductID).Editable(true);
        model.Field(p => p.UnitPrice).DefaultValue(Model);
        model.Field(p => p.Category).DefaultValue(
            ViewData["defaultCategory"] as Kendo.Mvc.Examples.Models.CategoryViewModel);
    })

Hope this helps.
 

Regards,
Konstantin Dikov
Progress Telerik
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
Grid
Asked by
Paul
Top achievements
Rank 1
Answers by
Konstantin Dikov
Telerik team
Share this question
or