Results 1 to 2 of 2
  1. #1
    Member
    Join Date
    Dec 2009
    Location
    athens
    Posts
    14

    Talking LS table how it works

    Hi ,
    i develop some pages with LS and i need to create on the same page many tables with data , i use servlet to print my table the tab OverwriteTable and pushPage

    as here everything is ok, only if i use formatValues function inside the servlet on the same <Script> </Script> tags
    when i put the formatValues on a separate <Script> </Script> tags then its not working
    i need to print my tables from servlet and use format functions from js
    so to use the same format.js for all pages

    SOME EXAMPLE

    ************************************************** **************************
    THIS WORKING

    <Script Language="JavaScript">
    //////////////// Stock Table Management
    // create an OverwriteTable; item and field names will be grabbed from
    // the corresponding HTML divs
    var table = new OverwriteTable(null, null, "MERGE");

    table.setDataAdapter("My_Adapter");
    table.setSnapshotRequired(true);
    table.onChangingValues = formatValues;

    // bind the table to the corresponding HTML divs
    pushPage.addTable(table, tableID);

    function formatValues(itemPos, visualUpdateInfo, itemName) {
    if (visualUpdateInfo != null) {
    var cold = (itemPos % 2 == 1) ? "#eeeeee" : "#ddddee";
    visualUpdateInfo.setRowAttribute("yellow", cold, "backgroundColor");
    }
    }
    </script>
    *********************************************

    THIS NOT WORKING

    <Script Language="JavaScript">
    //////////////// Stock Table Management
    // create an OverwriteTable; item and field names will be grabbed from
    // the corresponding HTML divs
    var table = new OverwriteTable(null, null, "MERGE");

    table.setDataAdapter("My_Adapter");
    table.setSnapshotRequired(true);
    table.onChangingValues = formatValues;

    // bind the table to the corresponding HTML divs
    pushPage.addTable(table, tableID);
    </script>

    SOME CODE HERE

    <Script Language="JavaScript">
    function formatValues(itemPos, visualUpdateInfo, itemName) {
    if (visualUpdateInfo != null) {
    var cold = (itemPos % 2 == 1) ? "#eeeeee" : "#ddddee";
    visualUpdateInfo.setRowAttribute("yellow", cold, "backgroundColor");
    }
    }
    </script>

    THANKS

  2. #2
    Power Member
    Join Date
    Jul 2006
    Location
    Cesano Maderno, Italy
    Posts
    784
    Hi,

    in your second example you're assigning to onItemUpdate a value that at that moment is undefined, that's why it does not work.
    Each <script> element is executed as soon as it is parsed; note that during the parsing phase functions inside the element are created, that's why the first example correctly work even if formatValue is declared below the piece of code that "uses" it (table.onChangingValues = formatValues; )

    There are several ways you can rewrite the code to let it work, just be sure that when you use something it already exists;
    e.g.: you may include the format.js above the "new OverwriteTable" code.

    HTH

 

 

Similar Threads

  1. How Pagination Works in DynaGrid
    By karthik655 in forum Client SDKs
    Replies: 2
    Last Post: April 25th, 2012, 07:02 AM
  2. Subscribing to the Table
    By AidasOzelis in forum Client SDKs
    Replies: 13
    Last Post: June 3rd, 2010, 02:13 PM
  3. Update Table
    By EWANG in forum Client SDKs
    Replies: 1
    Last Post: August 19th, 2009, 11:17 AM
  4. Replies: 1
    Last Post: July 3rd, 2009, 09:26 AM
  5. DynaMetapush table
    By georgeeapen in forum Client SDKs
    Replies: 2
    Last Post: April 21st, 2009, 12:17 PM

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 08:59 AM.