Page 1 of 1

[REACT]

Posted: Wed Feb 08, 2023 2:10 pm
by vconstruct

Hi,
We are not able to get the custom added/registered column values in exported excel file.

Here is the column definition

const columnDef: Partial<ColumnStoreConfig>[] | object[] = [
    {type: 'activityidcolumn'},
    {
      type: 'name',
      field: 'name',
      text: 'Activity Name',
      width: 350,
      editor: false,
    },
    { type: 'statuscolumn' },
    { type: 'date', field: 'startDate', text: 'Start Date', editor: false },
    { type: 'date', field: 'endDate', text: 'End Date', editor: false },
    { type: 'duration', field: 'duration', editor: false },
    {
      type: 'percentdone',
      field: 'percentDone',
      text: 'Progress',
      editor: false,
    },
    { field: 'critical', text: 'Is Critical', editor: false, hidden: true },
    {
      type   : 'resourceassignment',
      itemTpl  : (assignment: { resourceName: string; }) => assignment.resourceName,
      editor: false,
    }
  ];

And here is how we have registered the status column -
StatusColumn.js

import { Column, ColumnStore } from '@bryntum/gantt'

export class StatusColumn extends Column {
  static get $name() {
    return 'StatusColumn'
  }

  static get type() {
    return 'statuscolumn'
  }

  static get isGanttColumn() {
    return true
  }

  static get defaults() {
    return {
      field: '_data.status',
      text: 'Status',
      editor: false,
      cellCls: 'b-status-column-cell',
      htmlEncode: false,
      exportedType: 'string',
      filterable: ({value, record}) => {
        value = value.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
        if(record._data.status?.match(new RegExp(value, 'i'))){
          return record
        }
      }
    }
  }
}

Here is the excel snapshot

excel column value.png
excel column value.png (51.4 KiB) Viewed 262 times

Here is the Gantt preview

ganttColumnValue.png
ganttColumnValue.png (163.83 KiB) Viewed 262 times

Re: [REACT]

Posted: Wed Feb 08, 2023 8:47 pm
by mats
      field: '_data.status',

This looks wrong, I suspect it should be just 'status'? Does it work then?

Can you please share the Model definition too?


Re: [REACT]

Posted: Thu Feb 09, 2023 12:51 pm
by vconstruct

We are using the same format as in Bryntum. Here's the snapshot of it.

Modeldefinition.png
Modeldefinition.png (24.9 KiB) Viewed 220 times

And also attaching the json data for the reference

jsonformatter.txt
(124.7 KiB) Downloaded 16 times

Re: [REACT]

Posted: Thu Feb 09, 2023 10:44 pm
by marcio

Hey, I believe that the suggestion that Mats did would make it work. Could you please try it and check it?

Change

static get defaults() {
    return {
      field: '_data.status',

to

static get defaults() {
    return {
      field: 'status',

Re: [REACT]

Posted: Fri Feb 10, 2023 11:14 am
by vconstruct

Hi,
We already have tried it. It won't render value in the gantt control as well as in excel file


Re: [REACT]

Posted: Fri Feb 10, 2023 5:43 pm
by marcio

Ok, Could you please assemble a sample project with all your configuration and data processing?? We'll use the data that you provided in this post with your project to help identity what's causing that non-exporting issue.

You can get one of our demos and then adapt to match your case, and then zip it and send it here.