-
September 26th, 2017, 07:20 AM
#1
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>
-
September 26th, 2017, 08:57 AM
#2
Hi rvkvino,
You have two distinct options to do this.
- 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.
- 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
-
September 26th, 2017, 09:14 AM
#3
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 09:52 AM.
-
September 26th, 2017, 10:09 AM
#4
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
-
September 26th, 2017, 11:12 AM
#5
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.
Last edited by rvkvino; September 26th, 2017 at 11:36 AM.
-
September 26th, 2017, 02:44 PM
#6
Hi rvkvino,
I suppose that the rows reappear when an update does not change the involved field.
Please, try something like this:
Regards,
Giuseppe
-
November 15th, 2017, 06:10 AM
#7
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
}
-
November 15th, 2017, 08:52 AM
#8
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
-
By rvkvino in forum General
Replies: 3
Last Post: March 28th, 2017, 04:58 PM
-
By alexreinert in forum Client SDKs
Replies: 2
Last Post: July 21st, 2015, 10:35 AM
-
By Ranag in forum Adapter SDKs
Replies: 1
Last Post: December 12th, 2014, 09:03 AM
-
By GoatHunter in forum Client SDKs
Replies: 3
Last Post: August 31st, 2009, 08:57 AM
-
By ddhanis in forum Adapter SDKs
Replies: 1
Last Post: August 20th, 2009, 08:47 AM
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
All times are GMT +1. The time now is 01:50 AM.
Bookmarks