EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: baxter on September 20, 2012, 03:44:12 PM



Title: data(jq[0], "datagrid") is undefined
Post by: baxter on September 20, 2012, 03:44:12 PM
Since the last update i have the follow error in Firebug on all datagrids. What is wrong?

Code:
TypeError: $.data(jq[0], "datagrid") is undefined
options()jquery....min.js (Zeile 7686)
jq =

[table#orders.easyui-datagrid]

datagrid()jquery....min.js (Zeile 7553)
_541 =

"options"

_542 =

undefined

loader()jquery....min.js (Zeile 8087)
_5e7 = Object { methode=

"ListOrders"

, page=

1

, rows=

20

, mehr...}
_5e8 = function()
_5e9 = function()
_53b()jquery....min.js (Zeile 7507)
(?)()jquery....min.js (Zeile 7496)
error source line:
[Bei diesem Fehler anhalten]

var _58a=$.data(jq[0],"datagrid").options;


Title: Re: data(jq[0], "datagrid") is undefined
Post by: stworthy on September 20, 2012, 08:32:19 PM
Providing some test code you are using will be more appropriate.


Title: Re: data(jq[0], "datagrid") is undefined
Post by: baxter on September 21, 2012, 01:18:13 AM
Thanks stworthy, here is the code:

Code:
    $('#orders').datagrid({  
url:'/client/jclient.php',
pagination: true,
singleSelect: false,
queryParams: {"methode": "ListOrders"},
fitColumns: true,
idField:'orderid',
sortName: 'orderid',
        sortOrder: 'DESC',
pageSize:20,
pageNumber: 1,
loadMsg: LG1342,
rowStyler:function(index,row){
            if (row.userid){ return 'color:#0A5100;'; }
            return 1;
},
columns:[[  
   {field:'orderid', title:'Orderid', width:65, sortable:true},  
   {field:'userid', title:LG970, width:60,  sortable:true},  
   {field:'domain', title:LG1267, width:320, sortable:true},
   {field:'status', title:LG940, width:110, sortable:true},
   {field:'createtime', title:LG1348, width:130, sortable:true},
   {field:'regtime', title:LG1349, width:130, sortable:true},
   {field:'expiredate',title:LG1350,width:130, sortable:true},
   {field: 'Action', title:'', width:150, align:'center', formatter:function(value,row,index){
   
                    var a = '<select id="jumpDomAction_'+row.orderid+'" style="width: 160px" onchange="DomJump(this.options[this.selectedIndex].value, '+row.orderid+')">';
   a += '<option value="action" selected=selected disabled=disabled>'+LG941+'</option>';
   
   if(row.status.match(/TRANSFER-OK|REG-OK/)){

a += '<option value="update">'+LG194+'</option>';
a += '<option value="close">'+LG195+'</option>';

if(row.domain.match(/\.de$/)){
   a += '<option value="transit">'+LG196+'</option>';
}

if(row.hasAuthcode && !row.domain.match(/\.de$/)){
   a += '<option value="authcode">'+LG197+'</option>';
}

if(row.hasLock){
   if(row.lock == '1'){
a += '<option value="deLock">'+LG198+'</option>';
     }else{
a += '<option value="enLock">'+LG199+'</option>';
   }
}
   
if(row.domain.match(/\.de$/)){
   if(row.authcode){
a += '<option value="authinfo">'+LG1246+'</option>';
   }else{
a += '<option value="authinfo">'+LG1245+'</option>';
   }
}
   }
   a += '<option value="info">'+LG943+'</option>';
                    
                    a += '</select>';
                    
                    return a;
                }
            
            }
]],
onBeforeLoad: function(rowIndex,rowData){
   $('#domainBTNchange,#domainBTNclose').menubutton({ disabled: true });
},
        onClickRow:function(rowIndex,rowData){

   var orderid = rowData.orderid;
   
   var row = $('#orders').datagrid('getSelected');
   if(row){
$('#domainBTNchange,#domainBTNclose').menubutton({ disabled: false });
   }else{
$('#domainBTNchange,#domainBTNclose').menubutton({ disabled: true });
   }


            if(orderid){
document.getElementById("domaininfo").style.display = 'inline';
                document.getElementById("domaininfo_main").style.display = 'inline';
           
                $.post('/client/jclient.php', { methode: 'detail', orderid: orderid, view: 'table' }, function(data){
                    document.getElementById('domaininfo').innerHTML = data.table;
                },'json');
            }
        },
          
        onDblClickRow:function(rowIndex,rowData){
            
   var orderid = rowData.orderid;
   addTab('?tp=neworder&domainid='+orderid, LG1339, 'icon-domain');
        },

onBeforeRefresh:function(){
            $('#orders').datagrid('reload', {});  
        },
    });

And the json string (copy from firebug):
Code:
{"total":"74998","rows":[
{"orderid":"200997","domain":"domain1.de","status":"REG-OK","createtime":"15.09.2012 15:29:30","userid":"250469","regtime":"15.09.2012 15:29:33","action":null,"expiredate":"15.09.2013.15:29:33","hasAuthcode":1,"authcode":"","lock":"1","hasLock":false},
{"orderid":"200996","domain":"domain2.de","status":"REG-OK","createtime":"15.09.2012 13:24:37","userid":"250534","regtime":"15.09.2012 13:25:14","action":null,"expiredate":"15.09.2013.13:25:14","hasAuthcode":1,"authcode":"","lock":"1","hasLock":1},
{"orderid":"200995","domain":"domain3.de","status":"REG-OK","createtime":"15.09.2012 13:24:35","userid":"250534","regtime":"15.09.2012 13:24:37","action":null,"expiredate":"15.09.2013.13:24:37","hasAuthcode":1,"authcode":"","lock":"1","hasLock":1},
{"orderid":"200994","domain":"domain4.de","status":"REG-OK","createtime":"15.09.2012 13:24:34","userid":"250534","regtime":"15.09.2012 13:25:12","action":null,"expiredate":"15.09.2013.13:25:12","hasAuthcode":1,"authcode":"","lock":"1","hasLock":false},
{"orderid":"200993","domain":"domain5.de","status":"REG-OK","createtime":"15.09.2012 13:24:27","userid":"250534","regtime":"15.09.2012 13:24:34","action":null,"expiredate":"15.09.2013.13:24:34","hasAuthcode":1,"authcode":"","lock":"1","hasLock":false},
{"orderid":"200992","domain":"domain6.de","status":"TRANSFER-OK","createtime":"14.09.2012 20:18:05","userid":"202782","regtime":"14.09.2012 20:18:10","action":null,"expiredate":"14.09.2013.20:18:10","hasAuthcode":1,"authcode":"eNErDcKnU","lock":"1","hasLock":false},
{"orderid":"200991","domain":"domain7.de","status":"TRANSFER-OK","createtime":"14.09.2012 20:16:28","userid":"202782","regtime":"14.09.2012 20:16:34","action":null,"expiredate":"14.09.2013.20:16:34","hasAuthcode":1,"authcode":"+j672EF7z7Y","lock":"1","hasLock":false},
{"orderid":"200990","domain":"domain8.de","status":"TRANSFER-OK","createtime":"14.09.2012 20:15:45","userid":"202782","regtime":"14.09.2012 20:15:52","action":null,"expiredate":"14.09.2013.20:15:52","hasAuthcode":1,"authcode":"pgBhYyzCN*ytU","lock":"1","hasLock":false},
{"orderid":"200989","domain":"domain9.de","status":"TRANSFER-OK","createtime":"14.09.2012 20:14:57","userid":"202782","regtime":"14.09.2012 20:15:03","action":null,"expiredate":"14.09.2013.20:15:03","hasAuthcode":1,"authcode":"CStS\/Ryw6i","lock":"1","hasLock":false},
{"orderid":"200988","domain":"domain10.de","status":"TRANSFER-OK","createtime":"14.09.2012 20:09:51","userid":"202782","regtime":"14.09.2012 20:09:55","action":null,"expiredate":"14.09.2013.20:09:55","hasAuthcode":1,"authcode":"UVNELeqJA","lock":"1","hasLock":false},
{"orderid":"200987","domain":"domain11.de","status":"TRANSFER-OK","createtime":"14.09.2012 20:06:26","userid":"250534","regtime":"14.09.2012 20:06:30","action":null,"expiredate":"14.09.2013.20:06:30","hasAuthcode":1,"authcode":"CRNCxJaFNTMvXdt4","lock":"1","hasLock":false},
{"orderid":"200986","domain":"domain12.de","status":"TRANSFER-OK","createtime":"14.09.2012 20:04:06","userid":"250534","regtime":"14.09.2012 20:04:13","action":null,"expiredate":"14.09.2013.20:04:13","hasAuthcode":1,"authcode":"CRNCxJaFNTMvXdt4","lock":"1","hasLock":false},
{"orderid":"200985","domain":"domain13.de","status":"REG-OK","createtime":"14.09.2012 16:56:10","userid":"250517","regtime":"14.09.2012 16:56:11","action":null,"expiredate":"14.09.2013.16:56:11","hasAuthcode":1,"authcode":"","lock":"1","hasLock":1},
{"orderid":"200984","domain":"domain14.de","status":"TRANSFER-OK","createtime":"14.09.2012 16:40:49","userid":"250534","regtime":"14.09.2012 16:40:54","action":null,"expiredate":"14.09.2013.16:40:54","hasAuthcode":1,"authcode":"CRNcEay5rvyaG72V","lock":"1","hasLock":false},
{"orderid":"200983","domain":"domain15.de","status":"TRANSFER-OK","createtime":"14.09.2012 16:39:53","userid":"250534","regtime":"14.09.2012 16:39:58","action":null,"expiredate":"14.09.2013.16:39:58","hasAuthcode":1,"authcode":"CRNcEay5rvyaG72V","lock":"1","hasLock":false},
{"orderid":"200982","domain":"domain16.de","status":"TRANSFER-OK","createtime":"14.09.2012 16:38:37","userid":"250534","regtime":"14.09.2012 16:38:41","action":null,"expiredate":"14.09.2013.16:38:41","hasAuthcode":1,"authcode":"CRNcEay5rvyaG72V","lock":"1","hasLock":false},
{"orderid":"200981","domain":"domain17.de","status":"TRANSFER-OK","createtime":"14.09.2012 16:35:18","userid":"250534","regtime":"14.09.2012 16:35:24","action":null,"expiredate":"14.09.2013.16:35:24","hasAuthcode":1,"authcode":"CRNcEay5rvyaG72V","lock":"1","hasLock":false},
{"orderid":"200980","domain":"domain18.de","status":"REG-OK","createtime":"14.09.2012 15:21:22","userid":"250517","regtime":"14.09.2012 15:21:25","action":null,"expiredate":"14.09.2013.15:21:25","hasAuthcode":1,"authcode":"","lock":"1","hasLock":false},
{"orderid":"200979","domain":"domain19.de","status":"REG-OK","createtime":"14.09.2012 13:48:07","userid":"250310","regtime":"14.09.2012 13:48:11","action":null,"expiredate":"14.09.2013.13:48:11","hasAuthcode":1,"authcode":"","lock":"1","hasLock":false},
{"orderid":"200978","domain":"domain20.de","status":"REG-OK","createtime":"14.09.2012 11:16:28","userid":"250517","regtime":"14.09.2012 11:16:30","action":null,"expiredate":"14.09.2013.11:16:30","hasAuthcode":1,"authcode":"","lock":"1","hasLock":false}]}

html:
Code:
<table id="orders" class="easyui-datagrid" style="height:auto" title="{%TPL['LG']['LG']['151']%}" iconCls="icon-domain"></table>


Title: Re: data(jq[0], "datagrid") is undefined
Post by: stworthy on September 21, 2012, 02:03:45 AM
It seems there are no problems with these codes. Here is the demo page using your code above.

http://jsfiddle.net/Y7dXa/