Get row index of uniq function

Get row index of uniq function

hsoft2020hsoft2020 Posts: 11Questions: 4Answers: 0

Hi. I use this function to get unique values of a column.

column.data().unique().sort().each( function ( data, j ){
myCodes
}

now I want to use the row index that is selected by above code and get value of specific cell of that row in myCodes section.But I dont know how

Answers

  • kthorngrenkthorngren Posts: 16,801Questions: 25Answers: 3,982

    I don't think there is a way to get the row index with that loop. One problem is the unique() API reduces the result set to just the unique data. So if you have duplicated data only one will be in the result. The data parameter will simply be the unique value and j is the counter for the loop.

    Please provide more detail of what you are trying to do so we can offer suggestions. If you can create a simple test case showing what you have maybe we can help with some code.
    https://datatables.net/manual/tech-notes/10#How-to-provide-a-test-case

    Kevin

  • hsoft2020hsoft2020 Posts: 11Questions: 4Answers: 0

    I have column with rendered data. Imagine that it has just 2 value. 0 for unpaid and 1 for paid. 0 and 1 are raw data that I rendered them into paid and unpaid.
    now I want to use individual search for this column using select tag.
    the value of select option will be 0 or 1 that is easy to capture by using data argument of the function. now for select text I need the rendered value.
    I want to get the row number of cell value that the unique() function returned and use it to get rendered value by this function:
    var x=this.cells(rowIndex,column).render('display');

  • kthorngrenkthorngren Posts: 16,801Questions: 25Answers: 3,982

    Use the row-selector as a function to get only the rows that match the loop value (data) in place of the rowIndex of the cell().render().

    Kevin

Sign In or Register to comment.