Page 1 of 2 12 LastLast
Results 1 to 10 of 12
  1. #1

    Unable to bind onclick event to an anchor tag

    Hi,

    I have an issue and stuck with it for quite sometime now. Can someone please guide me. I need to bind a onclick event to an anchor element dynamically, I checked the examples that Giuseppe's pointed out but still no luck. Let's say I have my html code like :

    <td id="msg" class="revSubject highlight" style="text-align:left;" nowrap="">
    <a href="#" data-source="lightstreamer" data-field="click" data-update="onclick">
    <span><div data-source="lightstreamer" data-field="msg"></div></span>
    </a>
    </td>


    In my js code I did set node types as well :
    grid.setNodeTypes(["div","tr","a"]);

    From my java adapter I'm send the click field :
    map.put("click", "getCCSInboxMsgBody(109539,0,&quot;SysTrdInbox &quo t;return false;");

    but still the event is not getting attached to the <a> element, I'm using DynaGrid with ADD command.

  2. #2
    Administrator
    Join Date
    Feb 2012
    Location
    Milano
    Posts
    716
    Hi Krishna Teja K,

    The snippet of code you attached seems correct to me and the onclick should be actually updated.
    Could you please try to trace if indeed your page receives the update with the click field? You could add a listener to your subscription, something like this:

    dynaGrid.addListener({
    onVisualUpdate: function(key,info,domNode) {
    if (info == null) {
    return;
    }

    info.forEachChangedField(tracefieldvalue);

    }
    })

    Regards,
    Giuseppe

  3. #3
    Hi Giuseppe,

    Thanks for the quick reply, yes you are correct the "
    click" field is not coming up even though I've added it to the java smart update arg map.

  4. #4
    Administrator
    Join Date
    Feb 2012
    Location
    Milano
    Posts
    716
    Hi Krishna Teja K,

    Ok, so we need to understand why your client don't receive the "click" field as expected.
    Please could you post here the code lines the client use to subscribe?
    Are you able to access the server log? In that case we could also take advantage of particular log settings.

    Regards,
    Giuseppe

  5. #5
    I just added a debugger and could see that the click field is present in "info.jJw" but not in "info.GVV", can you please explain what's happening here:

    Click image for larger version. 

Name:	2023-08-01.jpg 
Views:	233 
Size:	40.7 KB 
ID:	270

    I don't see the field even in this function: info.forEachChangedField(...)

  6. #6
    Here's my client subscription code:

    function linkToLS_Signal(lsTable,user_id,trdPlanStr,trdPlan SigType) {
    console.log("In linkToLS_Signal");
    require(["LightstreamerClient","Subscription","DynaGrid "],function(LightstreamerClient, Subscription, DynaGrid) {
    var client = new LightstreamerClient("https://push.finodex.com","TEST");
    client.connectionSharing.enableSharing("FdxShare", "ATTACH","CREATE");
    client.connect();
    var grid = new DynaGrid(lsTable, true);
    grid.setNodeTypes(["div","tr","a"]);
    grid.setAutoCleanBehavior(true,false);
    grid.addListener({
    onVisualUpdate: function(key, info, domNode) {
    if (info == null) {
    return;
    }
    var myField;
    info.forEachChangedField(function (field, value) {
    myField = field;
    info.setCellAttribute(myField, greenColor, null,"backgroundColor");
    info.setCellAttribute(myField, hotTxtCol, null,"color");
    });
    }
    });
    var subsList = ['trsignal_'+user_id+'_'+trdPlanStr+'_'+trdPlanSigT ype];
    var fieldsList = ['command', 'key', 'date', 'time', 'channel', 'msg', 'msgid'];
    subscription = new Subscription("COMMAND", subsList, fieldsList);
    //subscription.setRequestedSnapshot("no");
    subscription.addListener(grid);
    client.subscribe(subscription);
    });
    }

  7. #7
    Administrator
    Join Date
    Feb 2012
    Location
    Milano
    Posts
    716
    Hi Krishna Teja K,


    You need to add 'click' in the fieldsList.

    Regards,
    Giuseppe

  8. #8
    Thanks a lot, I overlooked it!

  9. #9
    Giuseppe, we have another requirement in our project where we need to clear the messages(rows) from the table which are currently pushed already let's say when user changes the filter or clicks a button. Right now even though the screen is refreshed the old messages are still present maybe due to the snapshot that it carries.

    I was able to clear the snapshot from the server by using the
    ItemEventListener's -> clearSnapshot(...) method but is there any other way that we can clear the snapshot from the client itself when the user performs certain action.

  10. #10
    Administrator
    Join Date
    Feb 2012
    Location
    Milano
    Posts
    716
    Hi Krishna Teja K,

    Sorry but your scenario is not totally clear to me, but have you tried to use removeRow?

    Regards,
    Giuseppe

 

 

Similar Threads

  1. Replies: 6
    Last Post: November 26th, 2012, 03:55 AM
  2. Anchor targetting in push page in Firefox, Chrome
    By tsezuu in forum Client SDKs
    Replies: 2
    Last Post: November 24th, 2011, 04:09 AM
  3. Replies: 6
    Last Post: March 26th, 2010, 05:09 PM
  4. Replies: 1
    Last Post: August 6th, 2008, 12:05 PM
  5. ER bind Unable to find the Engine
    By eduramires in forum Client SDKs
    Replies: 3
    Last Post: February 4th, 2008, 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 02:01 PM.