EasyUI Forum

General Category => Bug Report => Topic started by: Don_Juan on October 20, 2017, 03:55:26 AM



Title: Propertygrid (TypeError: this.groups is undefined)
Post by: Don_Juan on October 20, 2017, 03:55:26 AM
Hi,
I'm working with a propertygrid, and I found a problem.
When I create a propertygrid (contained in a window), at the first startup, when I click on any line and then another in console, this error occurs:

Chrome Browser    
    Uncaught TypeError: Cannot read property '1' of undefined (jquery.easyui.min.js:11851)
    at Object.refreshGroupTitle (jquery.easyui.min.js:11851)
    at Object.updateRow (jquery.easyui.min.js:11908)
    at Object.refreshRow (jquery.easyui.min.js:11364)
    at HTMLTableElement.<anonymous> (jquery.easyui.min.js:11165)
    at Function.each (jquery.min.js:2)
    at m.fn.init.each (jquery.min.js:2)
    at Object.refreshRow (jquery.easyui.min.js:11163)
    at m.fn.init.$.fn.datagrid (jquery.easyui.min.js:10816)
    at _774 (jquery.easyui.min.js:10515)
    at HTMLTableElement.<anonymous> (jquery.easyui.min.js:11152)

Firefox    
    TypeError: this.groups is undefined (jquery.easyui.min.js: 11851:5)

The creation of the group is as follows:
Code:
    $('#details').propertygrid('appendRow', {
        name: "Name",
        value: element,
        group: "Details"
    });
And so for all the lines.

If I close the window and reopen it, this problem does not happen anymore. What can it be?


Title: Re: Propertygrid (TypeError: this.groups is undefined)
Post by: jarry on October 20, 2017, 06:25:58 PM
Please look at this example http://code.reloado.com/ifijot4/edit#javascript,html,live. It works fine.


Title: Re: Propertygrid (TypeError: this.groups is undefined)
Post by: Don_Juan on October 23, 2017, 12:44:11 AM
Hi,
I try to use your example, but the problem is the same. The difference between my code and yours is the introduction of a new formatting of group name. The text change, write the number of lines, but the error of the first click persists.

It's new Error Code.

TypeError: _8e2 is undefined[Ulteriori informazioni]  jquery.easyui.min.js:11853:1
   refreshGroupTitle jquery.easyui.min.js:11853:1
   updateRow jquery.easyui.min.js:11908:1
   refreshRow jquery.easyui.min.js:11364:1
   refreshRow/< jquery.easyui.min.js:11165:1
   each jquery.min.js:2:2973
   each jquery.min.js:2:833
   refreshRow jquery.easyui.min.js:11163:8
   $.fn.datagrid jquery.easyui.min.js:10816:8
   _774 jquery.easyui.min.js:10515:1
   endEdit/< jquery.easyui.min.js:11152:1
   each jquery.min.js:2:2973
   each jquery.min.js:2:833
   endEdit jquery.easyui.min.js:11151:8
   $.fn.datagrid jquery.easyui.min.js:10816:8
   _8a8/< jquery.easyui.min.js:11674:1
   each jquery.min.js:2:2973
   each jquery.min.js:2:833
   _8a8 jquery.easyui.min.js:11671:1
   onClickCell jquery.easyui.min.js:11646:1
   _6c4 jquery.easyui.min.js:9668:1
   bindEvents/< jquery.easyui.min.js:11774:1
   dispatch jquery.min.js:4:8497
   add/r.handle jquery.min.js:4:5235


Have you other solution?
Thanks


Title: Re: Propertygrid (TypeError: this.groups is undefined)
Post by: jarry on October 23, 2017, 03:01:19 AM
Please show an example to demonstrate your issue.


Title: Re: Propertygrid (TypeError: this.groups is undefined)
Post by: Don_Juan on October 23, 2017, 03:46:01 AM
Sure!
I used the prototype, because I want to reuse some components, declaring them once, and invoking them whenever I need them.

File JS N.1 (pageBaseViews.js)
Code:
function pageBaseViews() {
}

pageBaseViews.prototype.device = function(device){
    $('#details').propertygrid('appendRow', {
        name: "Device",
        value: device,
        group: "details"
    });        
};
    
pageBaseViews.prototype.whoOwns = function(whoOwns){
    var dim = 0;
    try{
        var split  = whoOwns.split(",");
        var dim = split.length;
    } catch (Exception) {
        var dim = 1;
    }

    if(dim>1) {
        $.each(split, function (index, value) {
            $('#details').propertygrid('appendRow', {
                name: "whoOwns - " + (index+1),
                value: value,
                group: "details"
            });
        });                        
    } else {
        $('#details').propertygrid('appendRow', {
            name: "whoOwns ",
            value: whoOwns,
            group: "details"
        });            
    }  
};

pageBaseViews.prototype.associateTo = function(associateTo , type_Associate, name) {
    var dim = 0;
    try{
        var split1 = associateTo.split(",");
        var split2 = type_Associate.split(",");
        dim = split1.length;
    } catch (Exception) {
        dim = 1;
    }
    if(dim>1) {
        $.each(split1, function (index, value) {
            $('#details').propertygrid('appendRow', {
                name: "Associate To",
                value: value,
                group: "Associate - " + name + " - " + value
            });
            $('#details').propertygrid('appendRow', {
                name: "Type Associate",
                value: split2[index],
                group: "Associate - " + name + " - " + value
            });                
        });
    } else {
        $('#details').propertygrid('appendRow', {
            name: "Associate To",
            value: associateTo,
            group: "Associate"
        });
        $('#details').propertygrid('appendRow', {
            name: "Type Associate",
            value: type_Associate,
            group: "Associate"
        });
    }  
}; ....

pageBaseViews.prototype.initialized= function() {
    $('#details').propertygrid({
        scrollbarSize: 0,
        groupFormatter: groupFormatter,
        showGroup: true,
        columns: [[
            {
                field: 'name',
                title: 'Proprierty ',
                width: 150
            },
            {
                field: 'value',
                title: 'Value',
                width: 450
            }
        ]]
    });
  
    $('#infoViews').window({
        width:600,
        maxHeight:950,
        closed: true,
        maximizable: false,
        minimizable: false,
        resizable: false,
        collapsible: true,
        onBeforeClose:emptyGrid_Modify,
        modal:true
    });
    $('#infoViews').window('center');    
    
    function emptyGrid_Modify() {
        $('#details').propertygrid('loadData', {"total": 0, "rows": []});
    }
    
    function groupFormatter(fvalue, rows){
        return fvalue + ' - <span style="color:red">' + rows.length + ' rows</span>';
    }      
};

Now, I create a specific device Object, example Monitor (Monitor.js)

Code:
function Monitor(row) {
    Monitor.prototype = wide;
    Monitor.prototype = views_Monitor(row);
    Monitor.prototype = new pageBaseViews();    
}

function Wide(detail, wide) {
    $(detail).propertygrid('appendRow', {
        name: "Wide",
        value: wide==0 ? "NO" : "YES" ,
        group: "Info Model"
    });    
}

function views_Monitor(row) {
    $.get("getDetails.php", {id: row.id, device: row.device})
    .done(function (info) {
        var result  = $.parseJSON(info);
        $('#infoViews').window({title: result.name + " (" + result.device+ ")"});

        Monitor.prototype.initialized();
        Monitor.prototype.device(result.device);
        Monitor.prototype.whoOwns(result.owns);
        Monitor.prototype.associateTo(result.associateTo, result.typo_Associate, result.name);

        Wide('#details', result.wide);

        $('#infoViews').window({closed: false, width:'auto',height:'auto'});
        $('#infoViews').window('expand');            
        $('#details').propertygrid({width:'auto',height:'auto'});                  
        $('#infoViews').window('center');            
    });                
}

I hope I put everything!

Thanks so much


Title: Re: Propertygrid (TypeError: this.groups is undefined)
Post by: jarry on October 23, 2017, 07:05:29 PM
This example is modified from your code. It works fine. Please check your code logic carefully and try again.

http://code.reloado.com/ifijot4/2/edit#preview


Title: Re: Propertygrid (TypeError: this.groups is undefined)
Post by: Don_Juan on October 31, 2017, 02:52:23 AM
thank you alot, for yours suggestement, but after read your example and my code, I don't understand my logical programmation wrong.

I do not know exactly where the mistake may be

Thanks


Title: Re: Propertygrid (TypeError: this.groups is undefined)
Post by: Don_Juan on December 05, 2017, 08:20:23 AM
Other solutions or someone I like where is it wrong? I do not understand.
Thank you