Forum

November 2nd, 2014
A A A
Avatar

Lost password?
Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

The forums are currently locked and only available for read only access
sp_Feed Topic RSS sp_TopicIcon
I get error sometimes when loading jqGrid sometimes not
10/08/2009
04:00
Avatar
dseckin
Member
Members
Forum Posts: 3
Member Since:
10/08/2009
sp_UserOfflineSmall Offline

Hi folks,

I have been using jqGrid just for a couple weeks, i read some docs and blogs and build my grid well. At least i thought well. My web application using grid as a tree grid to show some values. The thing is jqGrid either works or not works with the same code.

The problem prevent the loading data to the grid when the page loading. Search the error and it seems that i forgot include some libraries jqGrid use, although i load everything i still get this weird error. It is weird because it works well sometimes, after working i start again application without any modifications then i get error.

Error string is "Object doesn't support this property or method", in the "grid.base.js" file there is a function called "addCell", VS 2008 always points the last row of this function

addCell = function(rowId,cell,pos,irow, srvr) {
            var v,prp;          
            v = formatter(rowId,cell,pos,srvr,'add');
            prp = formatCol( pos,irow);           
            return "<td role=\\"gridcell\\" "+prp+" title=\\""+$.jgrid.stripHtml(v)+"\\">"+v+"</td>";
        },

 

I think i'm missing something very easy but i couldn't find out, am i the only one getting this error out there? Frown

 

Here is the code of my aspx file i get error :

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <link rel="stylesheet" type="text/css" media="screen" href="css/jquery-ui-1.7.2.custom.css" />
    <link rel="stylesheet" type="text/css" media="screen" href="css/ui.jqgrid.css" />   
    <link rel="stylesheet" type="text/css" media="screen" href="css/thickbox.css" />   
   
    <script type="text/javascript" src="script/jquery-1.3.2.js"></script>
    <script type="text/javascript" src="script/jquery-ui.js"></script>   
    <script type="text/javascript" src="script/jquery.jqGrid.js"></script>
    <script type="text/javascript" src="script/grid.locale-tr.js"></script>   
    <script type="text/javascript" src="script/swfobject.js"></script>
    <script type="text/javascript" src="script/thickbox.js"></script>
   
    <script type="text/javascript">
        jQuery(document).ready(function(){
                 
          jQuery("#list").jqGrid({
            url:'XML4Live.aspx',
            datatype: 'xml',
            mtype: 'POST',
            colNames:['id','Yer','FiÅŸ Miktar','FiÅŸ Tutar', 'Ort.(%)'],
            colModel :[
              {name:'id', index:'id', width:1, hidden:true,key:true},                        
              {name:'Yer', index:'Donem', width:150, align:'left'},            
              {name:'FisMiktar', index:'fm', width:55, align:'right', formatter:'number'},
              {name:'FisTutar', index:'ft', width:90, align:'right', formatter:'currency'},
              {name:'Ort', index:'ort', width:80, align:'right', formatter:'number'},
            ],
            pager: '#pager',
            treeGrid: true,
            treeGridModel: 'adjacency',
            ExpandColumn : 'Yer',
            hegiht : 300,
            width : 700,
            caption: 'Canlı Bilgi (Bugünü Gösterir)'
          });
        });
    </script>

    <script type="text/javascript">       
        var params = {
          menu: "false",
          wmode: "transparent"
        };
        var attributes = {
          id: "ofc",
          name: "ofc",
          wmode: "transparent"
        };
   
        swfobject.embedSWF("open-flash-chart.swf", "ofc", "750", "300",
            "9.0.0", "expressInstall.swf",{"data-file":"XML4LiveGraph.aspx"}, params, attributes);
    </script>

</head>
    <body>
    <a href="AnalizGiris.aspx?height=200&width=400" title="Analiz GiriÅŸ Ekranı" class="thickbox">Analiz</a>
        <form id="form1" runat="server">
            <table id="list"></table>
            <div id="pager"></div>
            <br />
            <div id="ofc"></div>            
        </form>
    </body>
</html>

 

10/08/2009
06:04
Avatar
tony
Sofia, Bulgaria
Moderator
Members

Moderators
Forum Posts: 7721
Member Since:
30/10/2007
sp_UserOfflineSmall Offline

Hello,

Maybe you have inconsistency in the data returned from server - check the response - in most cases the number of the returned cols should equal of those defined in colModel.

Regards

Tony

For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.

10/08/2009
06:59
Avatar
dseckin
Member
Members
Forum Posts: 3
Member Since:
10/08/2009
sp_UserOfflineSmall Offline

Hi tony,

Thank you very much for your response.

According your comment, i checked my data and found out nothing weird. Then i decided to give solid xml which has no error and built by hand (not dynamic). It only has one record, i thought that if i feed the grid simplest data, i shouldn't have the error if the error depends on the data.

I used same column structure with my previous post. And here is the data :

 

<?xml version=”1.0″ encoding=”utf-8″ ?>
<rows>
  <page>1</page>
  <total>1</total>
  <records>1</records>
<row>
  <cell>1</cell>
  <cell>İstanbul</cell>
  <cell>74</cell>
  <cell>4687</cell>
  <cell>97</cell>
  <cell>0</cell>
  <cell>NULL</cell>
  <cell>true</cell>
  <cell>true</cell>
</row>
</rows>
Unfortunately, i'm getting same error with a little lower percent. 1 error out of 3 or 5 times.
Is there any data problem you folks can see? Or it depends on my VS2008 or something else? Any idea extremely helpfull.
Have a nice day

10/08/2009
07:36
Avatar
tony
Sofia, Bulgaria
Moderator
Members

Moderators
Forum Posts: 7721
Member Since:
30/10/2007
sp_UserOfflineSmall Offline

            colModel :[
              {name:'id', index:'id', width:1, hidden:true,key:true},                        
              {name:'Yer', index:'Donem', width:150, align:'left'},            
              {name:'FisMiktar', index:'fm', width:55, align:'right', formatter:'number'},
              {name:'FisTutar', index:'ft', width:90, align:'right', formatter:'currency'},
              {name:'Ort', index:'ort', width:80, align:'right', formatter:'number'}, <----- Error here - remove this
            ],

Regards

Tony

For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.

10/08/2009
07:46
Avatar
dseckin
Member
Members
Forum Posts: 3
Member Since:
10/08/2009
sp_UserOfflineSmall Offline

Thank you very much tony, you are great. It works well now.

12/08/2009
09:31
Avatar
Alex
Guest
Guests

Coming form the C# and Java world and being new to Javascript I am amazed at the richness of fucntionality and good looks of the grid. Everything works great for me, except one problem, exactly the same as reported here. For me this happens only in IE and only on a first load after the browser stratup. Subseqent loads work fine.  Fifefox and Chrome do not have the problem. The fix suggested by Tony (removing comma?) does not apply to me, I do not have comma at the last coulmn definition. Here is my script:

jQuery(document).ready(function(){ 

jQuery("#treegridc").jqGrid({

treeGridModel: "adjacency",

ExpandColumn : 'customer',

ExpandColClick : 'customer',

url: 'b.do?q=m',  

datatype: "xml",

mtype: "POST",

colNames:['No','Customer', 'Sector', 'Volume', 'T Volume','CT Volume','Hit Ratio','Tickets', 'T Tickets', 'CT Tickets', 'Hit Ratio'],

   colModel:[

    {name:'id',index:'id', width:1,hidden:true,key:true,sortable:false},

    {name:'customer',index:'customer', width:270,sortable:false},

    {name:'sector',index:'sector', width:90,sortable:false},

    {name:'volume',index:'volume', width:80, align:"right",sortable:false},

    {name:'tvolume',index:'tvolume', width:90, align:"right",sortable:false},

    {name:'ctvolume',index:'ctvolume', width:105, align:"right",sortable:false},

    {name:'vratio',index:'vratio', width:70, align:"right",sortable:false},

    {name:'tickets',index:'tickets', width:70, align:"right",sortable:false},

    {name:'ttickets',index:'ttickets', width:90, align:"right",sortable:false},

    {name:'cttickets',index:'cttickets', width:105, align:"right",sortable:false},

    {name:'tratio',index:'tratio', width:70, align:"right",sortable:false}

],

   height:'auto',

   imgpath: "jqgrid3.5/css/redmond/images",

   treeGrid: true,

   caption: "Hit ratios by customer for last 15 days"

});

});

I traced the error to the same line in addCell in grid.base.js: 

return "<td role=\\"gridcell\\" "+prp+" title=\\""+$.jgrid.stripHtml(v)+"\\">"+v+"</td>";

 
and expression $.jgrid.stripHtml(v). v is a valid value, but stripHtml is not a method  in $.jgrid. In good runs $.jgrid is an object with stripHtml, htmlDecode and other methods. In a bad run it has properties defaults, search, edit, etc., but no methods. I wish I had better understnding of Javascript to be able to trace it further.
Thanks,
Alex
13/08/2009
02:33
Avatar
tony
Sofia, Bulgaria
Moderator
Members

Moderators
Forum Posts: 7721
Member Since:
30/10/2007
sp_UserOfflineSmall Offline

Hello,

Do you have any special characters in the data?

P.S in 3.5 version you do not need

imgpath: “jqgrid3.5/css/redmond/images”,

The parameter is removed and not needed. Also I will remove all these from the demo files.

Best Regards

Tony

For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.

14/08/2009
16:51
Avatar
Alex
Guest
Guests

I downloaded jqGrid again and the error is gone. Not sure if my there were some changes in the code since  previous download or my installation was corrupted,  but I do not see the error anymore. There are might be  special characters, but I wrap them in CDATA.

Removed imgpath as well.

Thanks, Tony!

Alex

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

Currently Online:
127 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

OlegK: 1255

markw65: 179

kobruleht: 144

phicarre: 132

YamilBracho: 124

Renso: 118

Member Stats:

Guest Posters: 447

Members: 11373

Moderators: 2

Admins: 1

Forum Stats:

Groups: 1

Forums: 8

Topics: 10592

Posts: 31289

Newest Members:

, razia, Prankie, psky, praveen neelam, greg.valainis@pa-tech.com

Moderators: tony: 7721, Rumen[Trirand]: 81

Administrators: admin: 66

Comments are closed.
Privacy Policy   Terms and Conditions   Contact Information