Results 1 to 6 of 6

Thread: Allow property.Grid to bind to the source object

    You found a bug! We've classified it as EXTJS-14911 . We encourage you to continue the discussion and to find an acceptable workaround while we work on a permanent fix.
  1. #1
    Sencha User
    Join Date
    Jan 2011
    Posts
    10

    Default Allow property.Grid to bind to the source object


  2. #2
    Sencha Premium User evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    19,256

    Default

    Thanks for the report! I have opened a bug in our bug tracker.

  3. #3
    Sencha Premium Member
    Join Date
    Oct 2013
    Posts
    46

    Default

    Hello, is there a current workaround for this?

  4. #4
    Sencha Premium User
    Join Date
    Apr 2015
    Location
    Germany
    Posts
    122

    Default

    *upvote*

    Quote Originally Posted by mattkim View Post
    Hello, is there a current workaround for this?
    There seems to be a workaround posted here: http://javascript.ru/forum/extjs/556...erty-grid.html
    but my russian is not so good and I don't want to mess around with prototype and dynamic model definitions.

  5. #5
    Sencha Premium Member
    Join Date
    Nov 2014
    Posts
    4

    Default

    I solved this problem by modifying the property reader used by the grid to accept an Ext.data.Model object as its source.

    Code:
    Ext.define('Overrides.grid.property.Reader', {    override: 'Ext.grid.property.Reader',
    
    
        readRecords: function(dataObject) {
            var Model = this.getModel(),
                result = {
                    records: [],
                    success: true
                }, val, propName;
    
    
            if (dataObject instanceof Ext.data.Model) {
                dataObject = dataObject.data;
            }
            
            for (propName in dataObject) {
                if (dataObject.hasOwnProperty(propName)) {
                    val = dataObject[propName];
                    if (this.isEditableValue(val)) {
                        result.records.push(new Model({
                            name: propName,
                            value: val
                        }));
                    }
                }
            }
            
            result.total = result.count = result.records.length;
            return new Ext.data.ResultSet(result);
        }
    });

  6. #6
    Sencha User
    Join Date
    Apr 2013
    Posts
    137

    Default

    And not solved int ExtJs 6.2.1 yet!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •