Results 1 to 3 of 3
  1. #1

    Getting field value without subscribing to it

    Hi,

    I have a backend system which send the fields updatetime,bid,ask,last to the dataadapter of Lightstreamer. Updatetime is filled every time, the other fields are sometimes null.

    On the client I want a scrolling grid, which gets all updates of the field last, where the field is not null. Easy thing, a Dynagrid with a subscription to the field last, works perfect.

    Now I want the updatetime in this grid, too. Just adding to the subscription will not work obviously, because then I get all events to the scrolling grid, even if the last is null. Is there a way, to tell the subscription, that the field updatetime should be transferred to the client when any other field triggers the subscription, but should not trigger when just this field within the subscribed fields is changed, or do I have to extend the field list sent to the dataadapter with a copy of the field updatetime, which is only filled when the last field is filled?

    Thanks,
    Alex

  2. #2
    Administrator
    Join Date
    Feb 2008
    Location
    Siracusa
    Posts
    152
    Hi Alex,

    on the client side, you could filter out update events which do not satisfy you criteria, for example by "overriding" the onItemUpdate method of DyanGrid in the following way:

    Code:
    // Save the reference to the original "onItemUpdate" method.
    dynaGrid.originalOnItemUpdate = dynaGrid.onItemUpdate;
    
    // Override the "onItemUpdate" method.
    dynaGrid.onItemUpdate = function(update) {
        // Assuming "last" and "updatetime" as the field names of your field schema.
        var last = update.getValue("last");
        var updateTime = update.getValue("updatetime");
    
        // Result of your matching criteria. 
        var canUpdate = false;
        // Insert here your logic to verify if your criteria can be satisfied.
        [...]
        //
        if (canUpdate) {
            // Invoke original method to fire visual updates.
            this.originalOnItemUpdate(update);
        }
    }
    Furthermore, you have the possibility to use the "selector", but in this case you must also adding some logic in the Metadata Adapter.
    Let me know if selector may be an option and, in that case, we can assist you by providing more details on this.

    Thanks and Regards,
    Gianluca

  3. #3
    Hi,

    this works perfect for me.

    Thanks,
    Alex

 

 

Similar Threads

  1. Replies: 4
    Last Post: January 12th, 2015, 09:36 AM
  2. Replies: 4
    Last Post: September 24th, 2013, 09:28 AM
  3. getting field value directly via javascript
    By pluczak in forum Client APIs
    Replies: 1
    Last Post: April 3rd, 2012, 09:36 AM
  4. Getting old value
    By shreyaspurohit in forum Client APIs
    Replies: 5
    Last Post: December 17th, 2008, 01:19 PM
  5. having problem while subscribing pairs
    By rekhender in forum Adapter APIs
    Replies: 1
    Last Post: October 31st, 2008, 09:58 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 04:32 AM.