[Solved] Reading row value

[Solved] Reading row value

anjibmananjibman Posts: 115Questions: 10Answers: 0
edited November 2011 in General
I have rows with check box as follow which has unique value for each.
[code][/code]

Then I am storing all rows in a variable.
[code]var aTrs = oTable.fnGetNodes();[/code]

Now simply I want to display that unique value. I am trying with "value" as
[code]alert(aTrs.value);[/code]

But its not showing that unique value for that row. How can i get that unique value?

Thanks
Anjib

Replies

  • jamillerjamiller Posts: 27Questions: 0Answers: 0
    The reason it's not working is because aTrs is an array of string arrays (multidimensional array) based on your input parameters. You're going to have to loop through that array at some event, i.e. button click event, to gather the values.

    [code]
    var valueStorageArray = [];
    var columnWithTheCheckbox = 3 // This assumes that the 4th column from the left has the checkbox, based on a starting column index of 0.
    for(var i in aTrs)
    {
    // i is the row & delete is the name of the checkbox
    var nCheckbox = aTrs[i][columnWithTheCheckbox].delete;
    if(nCheckbox.checked) valueStorageArray.push(nCheckbox.value);
    }
    [/code]

    That will give you an array of all checked checkbox values. You can then do whatever you need with them.
This discussion has been closed.