Datatable export into excel or pdf DOES NOT Work anymore in Version 9.2.0

While using this in datatable columns:

{
                id: 'tasktype_id',
                editor: 'combo',
                suggest: common.table.sizing(),
                header: _tables.kind,
                adjust: 'data',
                autowidth: true,
                options: 'getOptions->Tasktypes',
            },

and getOptions is a customer proxy with:

    webix.proxy.getOptions = {
        init:function(){
            webix.extend(this, webix.proxy.rest);
        },
        $proxy:true,
        load: function(view,params){
            let source = this.source;
            let result = webix.storage.local.get(source);
            //result=null;
            if(result){
                console.log('load '+source+' options from cache');
                return result;
            }
            let url = '/'+source+'/getOptions';
            return webix.ajax(url,function(text,data){
                console.log('load '+source+' options from server');
                webix.storage.local.put(source, data.json());
            });
        },
        save:function(view, params){
            return webix.proxy.rest.save.call(this, view, params);
        }
    };

This has been worked well in version 9.0.0 but not in 9.2.0 anymore :frowning:

I can’t change my version to 9.2.0 or higher before I resolved this problem. And I don’t know where to search for this error??

So please HELP ME Thank you

Michael

Hello! Thank you for your report, we have located and confirmed the issue, we are looking into it.

As a temporary workaround, I can suggest redefining the column template. The issue is with the default column template, when export is called it fails to get collection from the column parameter. So define the template to get the collection from column config in this case, something like:

{
      id: 'title',
      editor: 'combo',
      adjust: 'data',
      fillspace: true,
      collection: option_data,
      template: (obj, common, value, column) => {
            if (!column.collection){
                 const col = $$("data").getColumnConfig("title");
                 column.collection = col.collection;
            }
            return column.collection.getItem(obj.title).value;
      }
 }

https://snippet.webix.com/jjfjdy9k

Thank you kuro!

But this doen’t work cause I get data over a customer proxy collection!

The other point is cell formating. This is my part of a origin table:
table_origin

First column is date second is time and the 3. column is value of my data collection from combo editor option.

The result for data export into excel table comes like this:

You see the columns are wrong formatted! And in the 3. column I got the option/collection ID instead of values :frowning:

Maybe did I make something wrong?
Please help me urgend cause this is on production server :frowning:

Regards :stuffed_flatbread:

Michael

try to use this template instead:

          template: (obj, common, value, column) => {
            if (!column.collection){
              const col = $$("data").getColumnConfig(column.id);
              column.collection = col.collection; 
            }
            let item = column.collection.getItem(value);
            return item?item.value:value;
          }

https://snippet.webix.com/3lt5g0lr

1 Like

Thanks a lot integral, this helps me.

The main error comes with

rawValues: true

In this case.

Thanks a lot integral.

The main error comes with

rawValues: true

In this case.

For me it would be better that I can use docHeaderImage also with png or gif beside jpg image files while exporting dataTables into pdf!

Thank you
Michael

try this hack if you need rawValues:true

          template: (obj, common, value, column, index) => {
            if (!column.collection){
              const col = $$("data").getColumnConfig(column.id);
              column.collection = col.collection; 
            }
            let item = column.collection.getItem(value);
            if(item){
              obj[column.id] = value = item.value;
              if(index==$$("data").count()-1){
                delete column.template;
              }
            }
            return value; 
          }

https://snippet.webix.com/t88ahpei

Hello integral.

I do not need rawValues:true. So If I use your second solution this will mix up id and value and this makes everything worse … but your first idea is great. Thanks a lot and

all to you happy eastern time :slight_smile:

Michael

Thank you and have a fine eastern.

Michael

Hi again! We have fixed this bug, and if you update to 9.2.3, you will get it.
Sorry for the inconvenience and thanks for your patience, have a nice day :slight_smile:

1 Like

Very Nice. Thanks a lot! Do I need then your hotfix for templates in columns anymore?

1 Like

No, the workaround is no longer needed with 9.2.3

Great. And
please, please go on doing this great work. Don’t stop! :slight_smile:

Michael

1 Like

Thank you very much, we will :slight_smile:

1 Like