Page 1 of 2 12 LastLast
Results 1 to 10 of 20
  1. #1
    Senior Member
    Join Date
    Oct 2007
    Location
    HoChiMinh
    Posts
    69

    Error with VisualTable

    Hi,
    I going to http://app.lightstreamer.com/GridDemo and save as html file, after that i modified something.

    Here my changed : http://www.gls.com.vn:8080/priceonline/test.htm

    It has errors. See picture below.


    How to fix it?

    In NonVisualTable, i have two variables that will be passed to the NonVisualTable's constructor. Those variables will be Arrays. Each array's element is an item/field name.

    -------
    Here my code (in non-visualTable) :

    .....
    var schema = ["last_price", "time", "_change", "bid1", "bid1vol", "bid2", "bid2vol", "bid3", "bid3vol", "ref_price", "open_price", "stock_symbol", "ceiling" , "ask1", "ask1vol", "ask2", "ask2vol", "ask3", "ask3vol", "floor", "min", "max", "lastVol", "lastVal", "price1", "vol1", "price2", "vol2", "room", "remainingroom", "vnIndex", "idxVol", "idxVal", "idxchange", "idxperchange", "item_status"];


    var page1 = new Array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,17,18,19,20, 21,22,23,24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62 ,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,7 9,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95, 96,97,98,99,100, 101,102,103,104,105,106,107,108,109,110,111,112,11 3,114,115,116,117,118,119,120, 121, 122,123,124,125,126,127,128,129,130,131, 132,133,134,135, 136, 137, 138, 139,140,141,142,143,144,145,146,147,148,149,150,15 1,152,153, 154, 155);

    groupArray=page1;
    var groupString = "";
    var st = 1;
    for (st = 1; st <= 155; st++)
    {
    groupString += "item" + groupArray[st-1] + " ";
    }

    actGroup = groupArray;
    var newTable = new OverwriteTable(groupString, schema, "MERGE");
    ...
    -----------------
    Now, How about in VisualTable? Have I need Initialize two variables that will be passed to the VisualTable's constructor? If yes/no, How do I do?



    Thanks!

  2. #2
    Administrator
    Join Date
    Jul 2006
    Location
    Milan
    Posts
    973
    If you still refer to our GridDemo, note that there is no NonVisualTable in it.
    Each row of the table is associated to an instance of an OverwriteTable, which is created by a call to createAndAppendTable, while the set of all available items (i.e. the visible ones and the hidden ones) is fixed. Do you need to have this set dynamic, so that you need a NonVisualTable for this task?

    Also note that in the GridDemo implementation there is no "group" and "schema" variable. Item and field names are not passed directly to the OverwriteTable constructor (nulls are specified); they are rather cast in the cells, so that the OverwriteTable can look for them in the associated cells.
    Each time the table scrolls, cells from old lines are removed, together with their associated OverwriteTable instance; then, cells for new lines are dynamically added and associated to brand new OverwriteTable instances, through a "table"+index name.

    You should extend createTableDOM to handle all your fields and,
    as long as your item names have the form "item1", ... "item155",
    you should lean on the numeric argument of createAndAppendTable to address your various items. I think that the slider range configuration range:$R(1,26) is the only place where the total number of items is supplied (where the maximum position of 26 represents the first line of the farthest possible 5-rows scrollable screen).

  3. #3
    Senior Member
    Join Date
    Oct 2007
    Location
    HoChiMinh
    Posts
    69
    Hi Dario,
    In my application http://www.gls.com.vn:8080/priceonline/hose.html, I have too many items in the same page, resulting in a heavy snapshot being sent when you first load the page (CPU always 100%). So, to solve this problem, i try to do what you say (http://www.lightstreamer.com/vb/showthread.php?t=333).

    Do you need to have this set dynamic, so that you need a NonVisualTable for this task?
    I don't understand "set dynamic" --> what "set dynamic" for? items or field names?

    Because in VisualTable, the item and field names are not passed directly to the OverwriteTable constructor. Now, in my code, i changed :
    ------
    function createAndAppendTable(index)
    {
    ...
    var newTable = new OverwriteTable(null, null, "MERGE");
    }

    It still has error --> http://www.gls.com.vn:8080/priceonline/test.htm, and my slider didn't show.

    You should extend createTableDOM to handle all your fields and,
    as long as your item names have the form "item1", ... "item155",
    you should lean on the numeric argument of createAndAppendTable to address your various items
    -----
    If you can, please give me the simplest structure, like this :
    Constructor
    ....
    method:
    contents of this method
    ...

    By the way, can you explain more about (marked by red color) :
    function createTableDOM(index)
    {
    if (typeof parkedDOM[index] != "undefined" && parkedDOM[index] != null)
    {
    return parkedDOM[index]; --> purpose of variables.?
    }
    ...
    }

    Thanks!

  4. #4
    Power Member
    Join Date
    Jul 2006
    Location
    Cesano Maderno, Italy
    Posts
    784
    In my application http://www.gls.com.vn:8080/priceonline/hose.html, I have too many items in the same page, resulting in a heavy snapshot being sent when you first load the page (CPU always 100%). So, to solve this problem, i try to do what you say (http://www.lightstreamer.com/vb/showthread.php?t=333).
    I have no access to port 8080 at the moment, btw if the 100% problem is just on the snapshot you could try other approaches than the grid. eg.: don't show any illumination (if any) on the snapshot updates will reduce a lot the load on the cpu.

    Btw,

    It still has error --> http://www.gls.com.vn:8080/priceonline/test.htm, and my slider didn't show.
    again, I can't see the error at the moment, but note that you've to include script.aculo.us to show the slider and that script.aculo.us depends from prototype.js

    By the way, can you explain more about (marked by red color) :
    the parkedDOM is an object used as an hashmap that stores parts of DOM (each one containing the html for a line in the grid) that were created but are no longer in use (ie are not on the view). This way if due to the scrolling one of such lines returns back on the view there is no need to recreate it and the stored one can be used.

    HTH, please let me know if it's clear

  5. #5
    Administrator
    Join Date
    Jul 2006
    Location
    Milan
    Posts
    973
    About:
    Quote Originally Posted by tuongkha
    I don't understand "set dynamic" --> what "set dynamic" for? items or field names?
    I meant the set of all possible items to be scrolled in the page.
    As long as your set is not dynamic, but fixed, i.e. item1, ... , item155, it fits to the GridDemo example.

    About the current error:
    This is because the addField("up_down",...) tries to add the "up_down" field, but that field is already in the subscription schema.
    This, in turn, is because there are cells defined for the "up_down" field and the OverwriteTable(null, null, "MERGE") form gets the subscription schema by collecting all the field names used in the cells.
    Note that the original GridDemo code sets values on the "up_down" field in a different way.

  6. #6
    Senior Member
    Join Date
    Oct 2007
    Location
    HoChiMinh
    Posts
    69
    Hi Dario,
    I fixed my error ("up_down" field), but it still has error when you first page loaded -->
    http://www.gls.com.vn:8080/priceonline/test.htm

    Here my directory :
    C:\Lightstreamer\pages\priceonline\test.htm
    C:\Lightstreamer\pages\priceonline\js\prototype.js
    C:\Lightstreamer\pages\priceonline\js\scriptaculou s.js
    C:\Lightstreamer\pages\priceonline\js\controls.js
    C:\Lightstreamer\pages\priceonline\js\slider.js

    and my slider can't show.

  7. #7
    Administrator
    Join Date
    Jul 2006
    Location
    Milan
    Posts
    973
    Please consult a HTML expert.
    I suppose that setting width=100% on the first column of a table and width=30 on the second column prevents the second column from being shown.
    In your case, the first column of the outmost table contains an inner table with all the cells, while the second column contains the slider. I see that the HTML code that declares the slider is grayed in Firebug.

  8. #8
    Senior Member
    Join Date
    Oct 2007
    Location
    HoChiMinh
    Posts
    69
    Hi Dario,
    i know u aren't html expert (maybe), but i only going to http://app.lightstreamer.com/GridDemo and save as *.html file, just modified js script code (didn't modified html code).

    Here my modified --> http://www.gls.com.vn:8080/priceonline/test2.htm , but it didn't show slider bar. I don't know why in HTML code that declares the slider is grayed in Firebug.

    I hate to bother u but i'm a newbie in developer. I apologize about this.

    Here my error, when you first page load.
    -----------

  9. #9
    Power Member
    Join Date
    Jul 2006
    Location
    Cesano Maderno, Italy
    Posts
    784
    Hello,

    please, try to enable firebug and check if there are javascript errors.
    have configured correctly the domain settings? (if you grab our html the page is configured with the "lightstreamer.com" domain)

  10. #10
    Senior Member
    Join Date
    Oct 2007
    Location
    HoChiMinh
    Posts
    69
    Hi Mone,
    I have enabled firebug and there aren't js errors.

    Here my configured in html page, i removed "lightstreamer.com" domain :
    --------------
    var lsPage = new PushPage();
    var debugAlerts = true;
    var remoteAlerts = false;
    var pushHost = null;


    //for test
    lsPage.context.setDomain(null);

    lsPage.context.setDebugAlertsOnClientError(debugAl erts);
    lsPage.context.setRemoteAlertsOnClientError(remote Alerts);

    lsPage.onEngineCreation = function(lsEngine)
    {
    lsEngine.context.setDebugAlertsOnClientError(debug Alerts);
    lsEngine.context.setRemoteAlertsOnClientError(remo teAlerts);

    lsEngine.connection.setLSHost(pushHost);
    lsEngine.connection.setLSPort(null);
    lsEngine.connection.setAdapterName("HOSE");

    lsEngine.policy.setMaxBandwidth(30);
    lsEngine.policy.setIdleTimeout(30000);
    lsEngine.policy.setPollingInterval(1000);

    lsEngine.changeStatus("STREAMING");
    }

    lsPage.bind();
    lsPage.createEngine("SLEngine","ls/");
    ----
    And here my Firebug screen :


 

 

Similar Threads

  1. Choice of VisualTable and Event handlers
    By genkijo in forum Client APIs
    Replies: 1
    Last Post: July 20th, 2010, 09:20 AM
  2. visualtable's hottime and old machines
    By cbrogliato in forum Client APIs
    Replies: 6
    Last Post: May 8th, 2010, 09:14 PM
  3. Replies: 3
    Last Post: January 21st, 2010, 12:25 PM
  4. format value in VisualTable
    By tuongkha in forum Client APIs
    Replies: 9
    Last Post: July 9th, 2008, 09:27 AM
  5. VisualTable = How to capture value?
    By bayu in forum Client APIs
    Replies: 1
    Last Post: December 17th, 2007, 10:14 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT +1. The time now is 05:08 PM.