Editable Mode InLine event lifecycle and triggers

2 posts, 0 answers
  1. Paul
    Paul avatar
    4 posts
    Member since:
    Sep 2016

    Posted 20 Jun Link to this post

    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.

  2. Konstantin Dikov
    Admin
    Konstantin Dikov avatar
    2066 posts

    Posted 22 Jun Link to this post

    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.
Back to Top