[ Datatable ] Define template of specific column before Data is loaded

edited August 2017 in Technical questions

Good day,

is there a way to define template of specific column before data is loaded ?

I'm trying to do it with 'onBeforeLoad' event, '.config' and '.define' method , but as i understood you can't define columns template with '.define' or can you ?.

Something like this :

          onBeforeLoad: function () {

                var test = this.config.columns[1].id;
                // Gives error
                $$(test).define({ template: "<div class='one'>#sales#</div>" }); 


            },
Tagged:

Comments

  • edited August 2017

    specific cell or column? cell is not created if data is not loaded.
    you can change column's template through

    table.getColumnConfig(id).template = function(){...};
    table.refresh();
    
  • @intregal Hopla , i wanted to write columns. Going to try your code. Thanks.

  • edited August 2017

    @intregal, It's me again. It seems like we can't use

           table.getColumnConfig(id)
    

    and

           table.getColumnIndex(id)
           table.columnId(number);
    

    with 'onBeforeLoad' Event.

    Is there maybe is a similar Event where we can access the columns config and change the column before whole data is loaded into table ?(i guess there isn't).

    Snippet: https://webix.com/snippet/ac27b8c1

  • There's anonStructureLoad event that triggers when the columns are ready: https://webix.com/snippet/d207d27c

  • Thank you @Helga. Have missed that.

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!