Datatable loop thru rows

Hi. I'm struggling with this one.
I'm have a datatable. I need to loop thru each row. Get the value of cell 1 and 2, depending on the value of the rest of the cells, i need to get the column header.
Example. Cell 1 and 2 in a row will be name and date, cell 3 to 18 will be values. If those values is anything other than ACD or blank i need to get the column heading for those cells.

Tagged:

Comments

  • DataFilter object works with any data available on the client-side and will render any valid string/HTML in header/footer content, so you can iterate through the data and do the needed checkup.

    https://webix.com/snippet/94bb7476

  • How to i set this to a specific datatable

  • Perhaps as an click event on a button

  • This will work in any datatable where

    header:[{content:"dynHeader"}]
    

    is set in a column configuration.

    Apart from the datatable init, you can set new configuration of the column header:

    grida.getColumnConfig("title").header = [{content:"dynHeader"}];
    grida.refreshColumns();
    

    Please note that refreshColumns refreshes the entire datatable and may affect the performance.

  • Thank you,

  • edited October 2017

    Hi, Setup is as follows.
    Sidebar and multiview. One of the cells in the multiview is a datatable.

    So when i do this.

    {id:"FullName", header:[{content:"dynHeader"}],adjust:"data",cssFormat:mark_cells},
    {id:"ShiftDate",header: "Date",adjust:"data",cssFormat:mark_cells}
    

    The navigation function to that cell stops working. If i remove the dynHeader code and just give the header a name then the navigation works fine.

    ???

  • Hi,

    Unfortunately, I can't repeat the described behaviour.
    Can you please provide a sample where the issue can be seen?

  • Hi, i got it working for now thanks.

  • Is there another way of doing this, example datatable.EachRow

  • edited November 2017

    Can you please explain the requirements?

    datatable.eachRow iterates through the rows regarding the applied filtering/sorting, so some data can be lost.
    datatable.data.each allows iterating through all data available on the client side with the 3rd parameter set to true:

    master.data.each(function(obj){
       console.log(obj.id+" "+column);
       if (obj && obj[column] && obj[column] != "ACD"){
           check++
       }
    }, master, true); 
    
  • Thank you. My Table setup is as follows. Columns: Full Name; Date; the rest of the columns headers is time starting at 00:00 ends 23:30 . 30 min incr.
    I need to loop thru each row, get the Full Name; Date; Value if not ACD or null and the column header for that value. So. it will look like this.
    Marco Zaaiman; 2017/11/13; Training; 08:00.
    I would like to share the code but it's very lengthy and have loads of dependents.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!