By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,109 Members | 932 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,109 IT Pros & Developers. It's quick & easy.

i want to compare two rows of same coloumn how i do it using javacript below is mycod

P: 6
Expand|Select|Wrap|Line Numbers
  1. var cellclass = function (row, columnfield, value) 
  2.                           {
  3.  
  4.                               //alert("row==>"+row+"column==>"+columnfield+"value===>"+value);
  5.                               var oldValue="";
  6.  
  7.                               //alert(valueOfPrevious);
  8.                               if (row == "0") {
  9.                                   oldValue=value;
  10.                                    colorValue='red';
  11.                                    return colorValue;
  12.                               }
  13.                               else 
  14.                               {
  15.                                   colorValue='red';
  16.                                   var data = $('#new_grid_data2').jqxGrid('getrowdata', row - 1); ///
  17.                                  var valueOfPrevious=data.ips;
  18.                                  //alert(valueOfPrevious);
  19.                                  var currValue=value.substr(0,value.lastIndexOf(".")+1);
  20.                                  //alert(value+"=====>"+currValue);
  21.                                  var previousValu=valueOfPrevious.substr(0,valueOfPrevious.lastIndexOf(".")+1);
  22.  
  23.                                  if (currValue==previousValu) 
  24.                                  {
  25.  
  26.                                      if(colorValue=="red")
  27.                                      {
  28.                                          //colorValue="red";
  29.                                        return 'red';
  30.  
  31.                                      }else {
  32.  
  33.                                          colorValue="";
  34.                                          return '';
  35.  
  36.                                      }
  37.                                  }
  38.                                  else {
  39.                                      if(colorValue=="")
  40.                                      {
  41.                                          colorValue="red";
  42.                                        //return '';
  43.  
  44.                                      }else {
  45.                                          colorValue="";
  46.                                          //return 'red';
  47.  
  48.                                      }
  49.                                      //colorValue="";
  50.                                      return colorValue;
  51.  
  52.                                  }
  53.                           }
  54.  
  55.                           if (value < 20) {
  56.                            return 'red';
  57.                           }
  58.                           else if (value >= 20 && value < 50) {
  59.                            return 'yellow';
  60.                           }
  61.                            else return 'green';
  62.                            }
Sep 15 '15 #1
Share this Question
Share on Google+
10 Replies


Dormilich
Expert Mod 5K+
P: 8,639
what problems do you experience?
Sep 15 '15 #2

P: 6
i am comparing ips which are in a single column
see the below structure here Ref_ip & Ref_irl are two coloumns

Ref_ip Ref_url
1.1.1.1 1
1.1.1.2 1
1.1.1.3 1

1.2.2.1 1
1.2.2.2 1
1.2.2.3 3

so as you can se i have ips like this if i have ip's like this those are same i have want to change the colur of the row ..i am only comparing 1.1.1 & if they are same then colur should be chaged to red
Sep 15 '15 #3

Dormilich
Expert Mod 5K+
P: 8,639
so as you can se i have ips like this if i have ip's like this those are same i have want to change the colur of the row ..i am only comparing 1.1.1 & if they are same then colur should be chaged to red
sorry, I didn’t understand that explanation. can you elaborate?
Sep 15 '15 #4

P: 6
form image you can see tht there is column called REFERRING IP it contains some ip addresses but from filter when i give some value for eg 2 then all ips having same ips adgreses except last address shoule come one below anothe and their colour should change to red
exmple:- 101.101.101.111
101.101.101.112 these ip row color sholud change to red
Sep 15 '15 #5

P: 6
this is screen shot.... refer it
Attached Images
File Type: jpg Screenshot from 2015-09-15 18:05:22.jpg (61.2 KB, 164 views)
Sep 15 '15 #6

Dormilich
Expert Mod 5K+
P: 8,639
can you upload that in a better resolution? it’s hardly readable.
Sep 15 '15 #7

P: 6
fere are the images.... find the files
Attached Images
File Type: jpg Screenshot from 2015-09-15 19:41:27.jpg (53.8 KB, 146 views)
File Type: jpg Screenshot2 from 2015-09-15 19:42:02.jpg (53.6 KB, 137 views)
Sep 15 '15 #8

Dormilich
Expert Mod 5K+
P: 8,639
those are as small and unreadable as the previous one.
Sep 15 '15 #9

P: 6
i am using ubuntu so the images are as it is please do something
Sep 16 '15 #10

Rabbit
Expert Mod 10K+
P: 12,364
Nothing can be done if there's no good information to work with. If the screenshots are too small, try typing out the data instead.
Sep 16 '15 #11

Post your reply

Sign in to post your reply or Sign up for a free account.