Results 1 to 8 of 8
  1. #1
    Power Member
    Join Date
    Sep 2013
    Location
    Coimbatore
    Posts
    121

    Update COMMAND mode values into separate DynaGrid

    I have an XML like below, I have created a class for this in my adapter and assigned values in that class for an update. In my user page, I could display list in a single table but I need to display in a separate table based on condition like com_is_coin.
    If com_is_coin is 0 means I need to display in one table and if com_is_coin is 1 means need to display in a separate table. Is this possible or is there any other solution for this. Please help me anyone to do this.


    I used DynaGrid in my client.
    And also I used COMMAND mode to connect my adapter and client.
    var fieldList = ["key", "command", "desc", "bid", "ask", "high", "low", "order", "coin"];
    I'm getting response values in the above field.


    <Commodities>
    <Commodity>
    <id>19</id>
    <name>GOLD 1 Grm</name>
    <selling_rate>3119</selling_rate>
    <buying_rate>-</buying_rate>
    <delivery_date>26/09/2017</delivery_date>
    <com_is_coin>0</com_is_coin>
    </Commodity>
    <Commodity>
    <id>31</id>
    <name>MCX GOLD OCT</name>
    <selling_rate>30115</selling_rate>
    <buying_rate>30111</buying_rate>
    <delivery_date>26/09/2017</delivery_date>
    <com_is_coin>1</com_is_coin>
    </Commodity>
    <Commodity>
    <id>32</id>
    <name>MCX SILVER DEC</name>
    <selling_rate>40481</selling_rate>
    <buying_rate>40476</buying_rate>
    <delivery_date>26/09/2017</delivery_date>
    <com_is_coin>1</com_is_coin>
    </Commodity>
    </Commodities>

  2. #2
    Administrator
    Join Date
    Feb 2012
    Location
    Milano
    Posts
    716
    Hi rvkvino,

    You have two distinct options to do this.
    1. The first, maybe a bit more complex, is to separate the table into two different items, but this requires changes both to the server-side and to the client side.
    2. The latter, is to use two dfferent DynaGrid, both listeners of the same subscription, and through the onVisualUpdate select the rows to display, in one grid only the row where the com_is_coin is 0 and and the other only the rows where com_is_coin is 1.


    Regards,
    Giuseppe

  3. #3
    Power Member
    Join Date
    Sep 2013
    Location
    Coimbatore
    Posts
    121
    Could you please help me to add condition within onVisualUpdate. Because I have tried this and struck to add condition and return values within this method.
    var liverateGrid = new DynaGrid("liverates",true);
    // If I add one more dynagrid means i will create one more instance
    //var coinliverateGrid = new DynaGrid("coinliverates",true);


    liverateGrid.setNodeTypes(["div","span","img","a"]);
    liverateGrid.setAutoCleanBehavior(true,false);
    liverateGrid.addListener({
    onVisualUpdate: function(key, info) {
    if (info == null) {
    return;
    }

    }
    });
    liverateGrid.setSort("order", false, true);

    I have tried like below code, but row column value only getting empty. Couldn't remove a row.
    if(fieldName == "coin"){
    console.log(info.getChangedFieldValue(fieldName));
    if(info.getChangedFieldValue(fieldName) == 1){
    liverateGrid.removeRow(key);
    }
    }
    Last edited by rvkvino; September 26th, 2017 at 10:52 AM.

  4. #4
    Administrator
    Join Date
    Feb 2012
    Location
    Milano
    Posts
    716
    Hi rvkvino,

    Please try something like this:



    Please note that you have to verify the correct name of the field and its default value, I have assumed: "com_is_coin" and "-".

    Regards,
    Giuseppe

  5. #5
    Power Member
    Join Date
    Sep 2013
    Location
    Coimbatore
    Posts
    121
    I have tried like below again, I can confirm I'm having the field as coin and getting a value as 1.

    if ((info.getCellValue("coin") == "-" ) || info.getCellValue("coin") == "1" ) {
    console.log(info.getCellValue("coin"));
    liverateGrid.removeRow(key);
    }
    But row getting create and values only display as empty. Empty row displaying there.
    In this below coin cell given as css display:none.

    Click image for larger version. 

Name:	emptyrow.jpg 
Views:	839 
Size:	52.1 KB 
ID:	228
    Last edited by rvkvino; September 26th, 2017 at 12:36 PM.

  6. #6
    Administrator
    Join Date
    Feb 2012
    Location
    Milano
    Posts
    716
    Hi rvkvino,

    I suppose that the rows reappear when an update does not change the involved field.

    Please, try something like this:


    Regards,
    Giuseppe

  7. #7
    Power Member
    Join Date
    Sep 2013
    Location
    Coimbatore
    Posts
    121
    Hi,
    This way helped me lot. Thanks for your assistance.I have one more issue now, I need to change the row background color based on this below condition. I could change the particular item background color, but couldn't change the whole row bg color.

    if(info.getCellValue("com_is_rm") == "1") {
    //info.setCellStyle("desc", "gold-label", "silver-label");
    //Here I need to change current row bg color
    }

  8. #8
    Administrator
    Join Date
    Feb 2012
    Location
    Milano
    Posts
    716
    Hi rvkvino,

    You should use the setAttribute method that configures the stylesheet changes to be applied to all the HTML cells of the involved row.
    Something like this:

    info.setAttribute("#ffff66", null, "backgroundColor");

    Alternatively, if you want to use styles defined in the css you have to use it the setStyle method.

    Regards,
    Giuseppe

 

 

Similar Threads

  1. Replies: 3
    Last Post: March 28th, 2017, 05:58 PM
  2. How to format values on initial "update"
    By alexreinert in forum Client SDKs
    Replies: 2
    Last Post: July 21st, 2015, 11:35 AM
  3. Null values on Item update
    By Ranag in forum Adapter SDKs
    Replies: 1
    Last Post: December 12th, 2014, 10:03 AM
  4. Lightstreamer going into polling mode randomly
    By GoatHunter in forum Client SDKs
    Replies: 3
    Last Post: August 31st, 2009, 09:57 AM
  5. Replies: 1
    Last Post: August 20th, 2009, 09:47 AM

Tags for this Thread

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:41 PM.