Results 1 to 10 of 17

Hybrid View

  1. #1
    Administrator
    Join Date
    Jul 2006
    Location
    Milan
    Posts
    1,091
    The sample page you are using as a base point sets the cell highlighting (i.e. "hot") color for all changed fields based on the change of the "last_price" field value. This necessarily involves a two-phase process:
    in "updateItem" the change is analyzed and the proper color is stored in an extra field (namely 214);
    then, in "formatValues", the color is assigned as the "hot" background color to all the cells in the row (note that only changed cells will be highlighted).
    Does this still work for the "last_price" field?

    Other code is not relevant for you; the only relevant code is:
    Code:
    function updateItem(item, updateInfo) {
       if (updateInfo == null) {
          return;
       }
    
       var oldLast = updateInfo.getOldValue("last_price");
       var newColor;
       if (oldLast == null) { //first update for this item
          updateInfo.addField(214,greenColor,true);
       } else if (updateInfo.isValueChanged("last_price")) {
          //at least second update
          if (oldLast > updateInfo.getNewValue("last_price")) {
             updateInfo.addField(214,redColor,true);
          } else {
             updateInfo.addField(214,greenColor,true);
          }
       } 
    } 
    
    
    function formatValues(item, itemUpdate) {
       if (itemUpdate == null) {
          return;
       }
    
       itemUpdate.setHotTime(600);
    
       //choose the backgroundColor
       var backC = (item % 2 == 1) ? "#eeeeee" : "#ddddee";
       var backH = itemUpdate.getServerValue(214);
       itemUpdate.setRowAttribute(backH,backC,"backgroundColor");
    }
    You seem to require two changes:
    1. The change of "last_price" should only affect the "last_price" cell; you can accomplish this by using the "setAttribute" API in place of the "setRowAttribute"; please find the details on these APIs here (the online web client APIs documentation root is http://www.lightstreamer.com/docs/cl...doc/index.html).
    2. The same code should be replicated for all the desired fields; this implies that you have to use more extra fields; you may prefer to name them by names (e.g. "last_price_color" in place of 214).

  2. #2
    Senior Member
    Join Date
    Oct 2007
    Location
    HoChiMinh
    Posts
    69
    Dear Dario,
    thanks for your help. i found my error. i forgot call updateItem(), formatValues() method.

    newTable.setClearOnDisconnected(true); //default is false
    newTable.setClearOnRemove(true); //default is false
    newTable.onItemUpdate = updateItem;
    newTable.onChangingValues = formatValues;
    newTable.setPushedHtmlEnabled(true);

    in my html.

  3. #3
    Senior Member
    Join Date
    Jan 2008
    Location
    Mumbai
    Posts
    39

    Question

    Hi Dario & Tuongkha,

    I changed the ExternalFeed.cs file according to my requirements and I can built it successfully, Now I want to implement this file on to lightstremer to get the changes according to my requirements in the browser So, for that what should I do ?
    where should I place the ExternalFeed.dll and what are the steps to be followed to get the changes?


    Thanks,

  4. #4
    Administrator
    Join Date
    Jul 2006
    Location
    Milan
    Posts
    1,091
    The full story is documented in
    DOCS-SDKs\sdk_adapter_dotnet\doc\DotNet Adapters.pdf
    where a step by step deployment of the Remote StockListDemo is shown. You should just replace the Data Adapter dll.
    In a few words, you have to mount special Proxy Adapters, supplied with Lightstreamer on the Server and ensure that the client pages ask for data from those adapters; then launch Lightstreamer Server and the Remote Server.
    For any problems in this phase, I revert to this thread.

 

 

Similar Threads

  1. Replies: 8
    Last Post: May 7th, 2008, 09:53 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:22 PM.