Results 1 to 7 of 7

Thread: auto reload grid data strange error

  1. #1

    Question auto reload grid data strange error

    Hello, I'm a fairly light weight developer so please let me know if i'm doing something wrong....

    Anyways i have a grid that i'm filling with an XMLReader and i would like to auto reload or refresh that data every 5 sec or so...

    so i setup a update manager on the grid object and called startAutoRefresh(5,loadCalls); where loadCalls is a function that just reloads the data.Store object... however this returns a weird firebug error of

    Code:
    uncaught exception: [Exception... "Component returned failure code: 0x80070057 (NS_ERROR_ILLEGAL_VALUE) [nsIXMLHttpRequest.open]" nsresult: "0x80070057 (NS_ERROR_ILLEGAL_VALUE)" location: "JS frame :: javascript: eval(__firebugTemp__); :: anonymous :: line 1" data: no]
    I'm not entirely sure what this is or why it's happening... if i hook the same function into a on click event then it works just fine.

    here is my grid definition:

    Code:
                           call = Ext.data.Record.create([
                                    {name: 'CallerId', mapping: 'CallerId'},
                                    {name: 'Status', mapping: 'Status'},
                                    {name: 'Queue', mapping: 'Queue'}
                            ]);
    
                            // create the Data Store
                            ds = new Ext.data.Store({
                                    // load using HTTP
                                    proxy: new Ext.data.HttpProxy({url: 'modules/helpdesk.php?a=listCalls'}),
    
                                    // the return will be XML, so lets set up a reader
                                    reader: new Ext.data.XmlReader({
                                            record: 'Call',
                                            id: 'UniqueId',
                                            }, call ) 
                            });
    
                            var cm = new Ext.grid.ColumnModel([
                                    {header: "CallerId", width: 120, dataIndex: 'CallerId'},
                                    {header: "Status", width: 180, dataIndex: 'Status'},
                                    {header: "Queue", width: 115, dataIndex: 'Queue'}
                            ]);
    
                            cm.defaultSortable = true;
    
                            // create the grid
                            var grid = new Ext.grid.Grid('grid-example', {
                                    ds: ds,
                                    cm: cm
                            });
                            grid.render();
                            ds.load();
                        
                            var calls_mgr = Ext.get('grid-example').getUpdateManager();
                            calls_mgr.startAutoRefresh(5,function () { ds.reload(); });
    i took out the loadCalls function here and just made it inline but neither way seems to work.

    (by the way if you can't tell... this is basically a copy paste from the example grid )
    any ideas?

  2. #2
    Sencha - Community Support Team jsakalos's Avatar
    Join Date
    Apr 2007
    Location
    Slovakia
    Posts
    27,664

    Default

    I have a hint (untested).

    UpdateManager is bound to an element and it is primarily designed to update the element's content. Let's say you have a div (container) and you want to set the content of that div with data (html markup) from a server.

    Now, in your code you get the UpdateManager of the grid's container and I guess this could be the source of the problem.

    Maybe you could create an empty hidden div, get update manager of that div and start autorefresh.

    Try, I hope this helps.

  3. #3

    Default

    welp thanks for the hint... that does seem to work in terms of it now updates the data store object and redraws the grid... however i'm still getting that error every 5 secs, which occurs at the end of the function right after the ds.reloads();

    So i'm not sure if this is a Ext error or something in firebug...

  4. #4

    Default

    I ran across this forum post and Animals solution seems to do the same work but without the errors... i'm still not sure why those errors appear, but if anyone else is interested in a solution that post seems to have it.

  5. #5
    Sencha User Animal's Avatar
    Join Date
    Mar 2007
    Location
    Bédoin/Nottingham
    Posts
    30,892

    Default

    My solution works because It's not using an UpdateManager.

    Your solution uses UpdateManager which pulls a data String from a specified URL and puts it into the innerHTML of its Element. That's not what you want is it?

    The URL will be undefined because you pass the result of a void function call as the URL parameter. So when the UpdateManager tells the XMLHttpRequest to open that URL, not surprisingly, it throws an error.

  6. #6

    Question what was animal's solution to the problem

    can you kindly let me know what the solution was that animal proposed... as i am having the same problem and would like to use animal's solution

    rgds,
    Mo

  7. #7

    Default good solution

    thanx it works....

Posting Permissions

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