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

Values are disappearing at in-Cell editing

1 Answer 336 Views
Grid
This is a migrated thread and some comments may be shown as answers.
CAD-OD
Top achievements
Rank 1
CAD-OD asked on 13 Mar 2015, 09:28 AM

Hi there,

I've created a grid which bounds on a "Special" object, which has "real" properties and a list of variable properties.

This is the (single) object:

public class DynPartView
    {
 
        Guid _Id;
        public Guid Id
        {
            get { return _Id; }
            set { _Id = value; }
        }
         
        List<Prop> _Properties;
        public List<Prop> Properties
        {
            get { return _Properties; }
            set { _Properties = value; }
        }
 
     ...snip...
 
        string _Standard;
        public string Standard
        {
            get { return _Standard; }
            set { _Standard = value; }
        }
 
        string _SelectedMKL;
        public string SelectedMKL
        {
            get { return _SelectedMKL; }
            set { _SelectedMKL = value; }
        }
 
        string _SelectedManufacturer;
        public string SelectedManufacturer
        {
            get { return _SelectedManufacturer; }
            set { _SelectedManufacturer = value; }
        }
              
        
    }
 
And this is the view:
@(Html.Kendo().Grid(Model)
    .Name("partgrid")
     
    .DataSource(dataSource => dataSource
        .Ajax()
        .Batch(true)  
        .ServerOperation(false)    
        .Model(m =>
        {
            int y;
             
            m.Id(d=>d.Id);
            m.Field(f => f.SelectedMKL);
            m.Field(f => f.SelectedManufacturer);
            m.Field(f => f.Standard).Editable(false);
 
            for (y = 0; y <= Model.PropertiesCount; y++)
                m.Field(f => f.Properties[y].Value);
                
          
 
        })
        .Read(read => read.Action("Read_DynParts", "Parts", new { typeID = _typeid, mklName = _name }))
        .Create(create => create.Action("EditingInline_Create", "Parts"))
        .Update(update => update.Action("EditingInline_Update", "Parts"))
 
    )
    .ToolBar(toolbar =>
        {
            toolbar.Create();
            toolbar.Custom().Text("Kopieren");
            toolbar.Save();
             
        })
        
        .Columns(columns =>
            {
                int j = 0;
                 
                columns.Bound(b => b.Id).Hidden();
                columns.Bound(b => b.SelectedMKL).Title("MKL");
                columns.Bound(b => b.Standard).Title("Norm");
                columns.Bound(b => b.SelectedManufacturer).Title("Hersteller");
 
                for (j = 0; j < Model.PropertiesCount; j++)
                {
                    string _title="";
                    if (Model.Count() >= 1)
                        _title = Model[0].Properties[j].Name;
 
                    columns.Bound(b => b.Properties[j].Value).Title(_title);
                         
                }
                     
                  
            })
                        
        .Resizable(r => r.Columns(true))
        .Editable(editable => editable.Mode(GridEditMode.InCell))
        .Filterable(ftb => ftb.Mode(GridFilterMode.Menu))
        .Pageable(page => page.Enabled(true).PageSizes(new int[] { 10, 30, 50, 100, 1000 }))
        .Sortable()
         
        .Selectable(sel => sel.Mode(GridSelectionMode.Single))
        .Reorderable(r => r.Columns(true))
         
)

The issue I have: If I click on a property, which is stored in Properties the value is disappearing in the editbox. If I click on a property, which is a "direct" member of the class (e.g. "SelectedMKL"), the value is correctly shown after clicking the cell.
See the Pictures attached.

How can I prevent the value from disappearing?

Greetings, Denis

1 Answer, 1 is accepted

Sort by
0
Alexander Popov
Telerik team
answered on 17 Mar 2015, 08:57 AM
Hello Denis,

It looks like the default editor template is not able to generate proper value binding data-bind attributes for those fields. Would you mind sharing the HTML code of the cell that is being edited? You can also use a custom editor templates where the value binding is manually taken care of.

Regards,
Alexander Popov
Telerik
 

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.

 
Tags
Grid
Asked by
CAD-OD
Top achievements
Rank 1
Answers by
Alexander Popov
Telerik team
Share this question
or