[ Datatable ] What is the best way to get specific columns and rows ?

Hi hi,

Just a small question here. What would be the best way to get the specific Columns and Rows from the Datatable and edit it CSS.

There are methods like

            .addRowCss   .addCellCSS  and .addCss

where you can define specific rows/cells by giving its ID and a CSS Class. Can you write a functions instead of a CSS Class like we do it by the template ?

Also there is a method

               .getColumnConfig()

here we can define the template of whole column. Is there maybe similar method for rows ? Where you can get specific row and edit it as we like. ( I know there is a getItem method , but mby there is something else )

Thank you for your time !

Comments

  • in column's template you can return different values depending on row object, id, index, value. all of them are passed in the arguments (obj, common, value, columnConfig, index).
    first question is not clear. may be you need column's cssFormat? https://docs.webix.com/api__ui.datatable_columns_config.html

  • @intregal , I'm bad at asking proper questions :) .

    I have a 'onStructureLoad' event in my datatable. In this event i want to edit some Columns and Rows/Cells.

    As you have already suggested with '.getColumnConfig(column_id)' i can select and change the column template.

    It would be also nice to get one specific row and change the looks of it or change the looks of its cell.

    There are .addRowCss .addCellCSS and .addCss methods where i can specify which row/cell to edit, but i don't want to make a css class specialy for that.

    Is there any other way to get and change rows/cell for example through config ?

    I hope this time it is more clear :D

  • edited August 11

    looks like you need dynamic styling.
    you can use addRowCss / addCellCss / addCss combining with webix.html.createCss

    var dynamicCss = webix.html.createCss({
        color: #requiredColor#;
        font-size: #requiredSize#;
        ...other dynamic attributes...
    });
    table.addCellCss(#rowid#, #colname#, dynamicCss);
    
  • @intregal, I think that will do the job, thank you. Oh boy , oh boy how much more i have to learn.

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!

In this Discussion