How can I get the column value into a string variable Please help

How can I get the column value into a string variable Please help

polachanpolachan Posts: 101Questions: 50Answers: 0

Hi
from the following code , the result is stored as array object in to the variable report. from there how can I store 4th column data into a string variable or into a list<string> variable
var url = "/Employee/GetDepotList";
table = $('#DepotTable').DataTable

report = table.rows({ selected: true }).data();

This question has an accepted answers - jump to answer

Answers

  • kthorngrenkthorngren Posts: 21,166Questions: 26Answers: 4,921

    If I understand your question correctly you will want to use pluck() to get the 4th column then maybe toArray() to get an array.

    Kevin

  • polachanpolachan Posts: 101Questions: 50Answers: 0

    kthorngren
    I applied your code but not working ,
    When I debug the variable report = table.rows({ selected: true }).data(); the data is coming as given below in the image
    Please can you view the image, from that value I want to get DepotNo into a string variable as '1','2','5','10' that is selected depot number of the data table

  • polachanpolachan Posts: 101Questions: 50Answers: 0

    When I applied the code
    var saleries = table.rows({ selected: true }).data().pluck('DepotNo'); it is showing as given

    I want to store the depotno like
    string _depots='1','2','3','4','5','6'
    Please can you help me

  • kthorngrenkthorngren Posts: 21,166Questions: 26Answers: 4,921
    Answer ✓

    string _depots='1','2','3','4','5','6'

    This is not valid syntax. Do you want a comma separated string or an array?

    If an array then chain toArray() as mentioned above.

    Kevin

  • colincolin Posts: 15,237Questions: 1Answers: 2,598
This discussion has been closed.