[CLOSED] GridPanel Error before editing

  1. #1

    [CLOSED] GridPanel Error before editing

    In the example below, please try and click the button in the toolbar. There will come a javascript error.

    ext.axd?v=4.0.0-rc:102800 Uncaught TypeError: Cannot read property 'isEntity' of undefined

    @{
        var x = Html.X();
    }
    @(
        x.GridPanel()        
            .ColumnModel(
                x.Column()
                    .Editor(x.TextField())            
                    .DataIndex("Name")
            )
            .Plugins(x.CellEditing())         
            .Store(
                x.Store()
                    .Fields(
                        x.ModelField().Name("Name")
                    )
            )        
            .TopBar(x.Toolbar()
                .Items(
                    x.Button()
                        .Text("Add")
                        .Handler(@"
                            var gp = this.up('gridpanel');
                            var editing = gp.findPlugin('cellediting');
                            var record = gp.store.add({});
                            editing.startEdit(record,0);
                        ")
                )
            )        
    )
    Last edited by fabricio.murta; Apr 05, 2016 at 7:34 PM.
  2. #2
    Hello @sveins12!

    On your line 26, pass the record, not an array with 1 record as argument and it should work.

    Notice, although you added a single record, the store's add() method returns an array of model items (records), not a single record, as it supports adding an array of records as well.

    So, perhaps you want to change also your line 25 to better represent what is going to be bound.

    So, lines 25 and 26 of your code sample may look like this:
    var addedEntryList = gp.store.add({});
    editing.startEdit(addedEntryList[0], 0);
    I hope this helps!
    Fabrício Murta
    Developer & Support Expert
  3. #3
    It sure did. Thanks.
    Last edited by sveins12; Apr 05, 2016 at 4:39 PM.
  4. #4
    Glad it solved your problem! Thanks for the feedback!
    Fabrício Murta
    Developer & Support Expert

Similar Threads

  1. Cell Editing in GridPanel using DragTracker
    By raidem in forum 2.x Help
    Replies: 0
    Last Post: Apr 23, 2015, 11:50 AM
  2. [CLOSED] [MVC] GridPanel autoscroll up after editing
    By UnifyEducation in forum 2.x Legacy Premium Help
    Replies: 4
    Last Post: Mar 17, 2015, 1:09 PM
  3. [CLOSED] Inline editing in GridPanel
    By vijay.sahu in forum 2.x Legacy Premium Help
    Replies: 5
    Last Post: Mar 21, 2013, 10:15 AM
  4. [CLOSED] Editing cell of gridPanel
    By supera in forum 2.x Legacy Premium Help
    Replies: 7
    Last Post: May 23, 2012, 12:47 PM
  5. How to change GridPanel editing row backcolor
    By kakagu in forum 1.x Help
    Replies: 0
    Last Post: May 08, 2012, 7:06 AM

Posting Permissions