Sortable with Grid in Batch mode issues

2 posts, 0 answers
  1. Tyler
    Tyler avatar
    58 posts
    Member since:
    Nov 2013

    Posted 10 Feb 2015 Link to this post

    I have a Grid that I want to edit in Batch mode. This all works as it should as in code below.

      .HtmlAttributes(new { @class = "ignore" })
      .ToolBar(toolbar =>
        if (pnlViewUserAccess == PageViewType.Edit || pnlViewUserAccess == PageViewType.Create)
          toolbar.Create().HtmlAttributes(new { @class = "ignoreDirty" });
      .Editable(editable => editable.Mode(GridEditMode.InCell))
      .Scrollable(s => s.Height("auto"))
      .Columns(columns =>
        columns.Bound(p => p.key).Title("Key");
        columns.Bound(p => p.label);
        columns.ForeignKey(p => p.fieldType, (System.Collections.IEnumerable)ViewData["FieldTypes"], "Value", "Text").Title("Field Type");
        columns.Bound(p => p.valueLength).Title("Field Length");
        columns.ForeignKey(p => p.searchable, (System.Collections.IEnumerable)ViewData["TrueFalse"], "Value", "Text").Title("Searchable");
        columns.ForeignKey(p => p.access, (System.Collections.IEnumerable)ViewData["Access"], "Value", "Text").Title("Access");
        columns.ForeignKey(p =>, (System.Collections.IEnumerable)ViewData["TrueFalse"], "Value", "Text").Title("Enabled");
        columns.Bound(p => p.order).Title("Order");
      .DataSource(dataSource => dataSource
        .Model(model =>
          model.Id(p => p.oid);
          model.Field(x => x.key).Editable(false);
          model.Field(x =>;
          model.Field(x => x.searchable).DefaultValue(false);
          model.Field(x => x.access).DefaultValue(3);
        .Events(e => e.Error("handleAjaxError"))
        .Update(update => update.Action("FieldDef_Update", "Forms"))
        .Create(update => update.Action("FieldDef_Create", "Forms"))
        .Read(read => read.Action("FieldDef_Read", "Forms", new { recordTypeOid = Model.Entity.Oid }))


    I then had a requirement to be able to 'order' and save the order of the rows. I decided to use the Sortable - again this was fine I could drag the rows and then on the onChange event of Sortable I updated the Grid datasource Order numbers. All good!
    However when I attempt to edit a cell I run into problems which I'll detail below:

    1. String\Text cell:
      1. dosnt retain the updated value or have the 'dirty' graphi iin top left of cell
      2. wont allow me to mouse click the right of the cell text - i have to use the arrow keys to append to the text.
    2. Numeric cell: cant use the spinners to update the number

    On the Sortable widget I tried different variations of .Filter(), .Handler() etc.. but couldnt get  it working properly. My Sortable code is below:

      .ContainerSelector("#myGrid tbody")
      .Filter("table > tbody > tr")
      .Events(events => events.Change("myGrid_onChange"))

  2. Alexander Valchev
    Alexander Valchev avatar
    2887 posts

    Posted 11 Feb 2015 Link to this post

    Hello Tyler,

    To resolve the issue you should exclude the currently edited row from the Sortable items using the filter option of the Sortable widget.
    For more information please check this help topic:

    Alexander Valchev

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

Back to Top