Our blazing fast Grid component built with pure JavaScript


Post by jhk »

Hi,

I'm using version 4.2.4.

I have a grid that uses the selectionMode feature with checkboxes. When I try to export my grid it appears that the checkbox column is also exported thus shifting the whole file (see attachment)

These are my relevant configurations:

  
{ excelExporterFeature: { exporterConfig: { // Choose the columns to include in the exported file // By not choosing any it will default to all. }, // pass the export library to exporter feature zipcelx, }, ...
selectionMode: { row: true, multiSelect: true, preserveSelectionOnDatasetChange: false, checkbox: true, showCheckAll: true, }, }

I have some 40 columns so I'd rather not type them out explicitly. Is there an easy fix :)?

Thanks

Attachments
Screenshot 2021-10-12 171425.png
Screenshot 2021-10-12 171425.png (19.36 KiB) Viewed 30 times

Post by mats »

Sure, you can configure the check column to not be exported. See checkbox docs for GridSelection#selectionMode

/**
             * The selection settings, where you can set these boolean flags to control what is selected. Options below:
             * @config {Object} selectionMode
             * @param {Boolean} selectionMode.row select rows
             * @param {Boolean} selectionMode.cell select cells
             * @param {Boolean} selectionMode.rowCheckboxSelection select rows only when clicking in the checkbox column
             * @param {Boolean} selectionMode.multiSelect Allow multiple selection
             * @param {Boolean|Object} selectionMode.checkbox Set to true to add a checkbox selection column to the grid,
             * or pass a config object for the {@link Grid.column.CheckColumn}
             * @param {Boolean} selectionMode.showCheckAll  true to add a checkbox to the selection column header to select/deselect all rows
             * @param {Boolean} selectionMode.deselectFilteredOutRecords true to deselect rows that are filtered out
             * @param {Boolean} selectionMode.includeChildren true to also select/deselect child nodes when a parent node is selected
             * @param {Boolean} selectionMode.preserveSelectionOnPageChange This flag controls whether the Grid should preserve
             * its selection when loading a new page of a paged data store
             * @param {Boolean} selectionMode.preserveSelectionOnDatasetChange This flag controls whether the Grid should preserve
             * its selection of cells / rows when loading a new dataset (assuming the selected records are included in
             * the newly loaded dataset)
             * @default
             * @category Selection
             */

And set its https://bryntum.com/docs/grid/api/Grid/column/CheckColumn#config-exportable value to false

Tired of debugging javascript errors in web applications? Try our powerful error logging service RootCause


Post by jhk »

Thanks for the quick reply!

I missed that in the docs. When I try to apply the changes it has no effect, but I do see it works in your demos.

The "hideable" property has no effect either so it leads me to think it's not reading my config object for the select.

Anything in my config that looks suspicious? (left out columns)

/* eslint-disable no-param-reassign */
import zipcelx from 'zipcelx';

import daLocale from '@/locales/da-DK';

import { oldValueRenderer, routeCellRenderer } from './cellRenderes';
import base from './base.config';

const PREFIX = 'taskList';

const getId = (col) => `${PREFIX}-${col}`;

export default (me, options) => ({
  ...base,

  excelExporterFeature: {
    exporterConfig: {
      // Choose the columns to include in the exported file
      // By not choosing any it will default to all.
    },

// pass the export library to exporter feature
zipcelx,
  },

  destroyStore: true,

  ref: PREFIX,

  id: PREFIX,

  selectionMode: {
    row: true,
    multiSelect: true,
    preserveSelectionOnDatasetChange: false,
    checkbox: {
      hideable: false,
      exportable: false,
      resiable: false,
    },
    showCheckAll: true,
  },

  columns: [
	.. left out
  ],

  searchFeature: false,

  cellMenuFeature: {
    items: {
      removeRow: {
        text: 'Slet',
        onItem: (evt) => me.onRemoveRow(evt),
      },
      copy: false,
      cut: false,
    },
  },

  listeners: {
    search: 'onSearchPerformed',
    finishCellEdit: 'onFinishCellEdit',
    selectionChange: 'onRowSelect',
    thisObj: me,
  },
});

Post by mats »

Oh yes - you'll need to upgrade to get this working, this 'checkbox' config option was added quite recently.

Tired of debugging javascript errors in web applications? Try our powerful error logging service RootCause


Post by jhk »

Yep that was it! Thanks :)


Post Reply