javascript - How to store <TR> id value in array, when I toggle? -


I am changing 'tr.subCategory1' and its siblings . >. At the same time I am trying to store my ID in this array like this list_Visible_Ids [$ (this) .attr ('id')] = $ (this) .css ('display')! = 'None'? 1: empty; (When I collapsed, I need the 'null' in the store at my id location, if I expand, then I need the store to store me 1 Need to place its ID). But every time the warning ($ (this) .css ('display')) showing block . How can I handle this?. So when I am compressed or expanded then it is accumulating 1 .

  $ (document) .ready (function () {$ ('tr [@ class ^ = RegText]').) (). ('TD'); List_Visible_Ids = []; Var idsString, idsArray; IdsString = $ ('# myVisibleRows'). Val (); IdsArray = idsString.split (','); $ .EEEE (AidsAre, Function () (If (=! "=" "=" "=!") {$ ('#' + This) .Syling ('. RegText') Toggle (); ListView_IDS [This] $ ('Tr.subCategory1') .css ("cursor", "pointer") .attr (click on "title", "expand / short"). (Function () { $ (This) .siblings ('. RegText') Toggle (); $ (this). Sybings ('Volume Reag Text'). Toggle (); //ALert($(this).css () '' Play ')) list_Visible_Ids [$ (This) .attr (' id ')] = $ (this) .css (' display ')! =' None '? 1: null;}); $ ('# Form1'). Submit (function () {IdsString = ''; (Various indices in list_wiz_id) {idsString + = (idsString! = ''? ',': '' ') + Index;} $ (' # MyVisibleRows'). Val (idsString); form1.submit ();}); });  

You can only tr , Only with her siblings (Class .regittext and . VolumeRegText ). So you have to check that when you store the state in the array it is visible. For this you can use .is (": hidden") on one of the siblings. The click function will then look like this

  $ ('tr.subCategory1'). Css ("cursor", "indicator") .attr ("title", "click to expand / collapse"). Click (function () {$ (this) .siblings ('. RegText'). Toggle (); var isHidden = $ (this) .siblings ('. VolumeRegText'). Toggle (). (': Hidden' ); List_wijay_IDs [$ (this) .attr ('id')] =! Hashide is 1: zero;});  

There is a lot to comment on the rest of the code. In

  $ ('tr [@ class ^ = RegText]'). Hide (). Children ('TD'); Leave  

. Children ('TD') , because you are not using this selection.


Code_visible_Ids = []; must be declared using var .


idsArray via looping, you it! = "" || this! = Null) , which should use and instead of and .

  $ Each (IdsArray, function () (if (it! = "" & Amp; it! = Null) {$ ('#' + this) .Syling ('. RegText') Toggle (); List_View_IDS [this] =  / P>     

> It also seems that you are using the old version of jQuery, because selectors have @ They were removed from using.


Comments