Our state of the art Gantt chart


Post by Gantt_user »

How do we go about selecting a specific row in the grid portion of the Gantt project?

I was taking a look at https://www.bryntum.com/docs/gantt/#Grid/view/mixin/GridSelection#function-selectRow
but I am not sure how do we get the grid instance of the Gantt if were just using the Gantt wrapper to render the chart?


Post by mats »

Here's how you access the Gantt instance (remember, the Gantt inherits from the Grid class).
https://bryntum.com/docs/gantt/#guides/integration/react.md#the-native-bryntum-gantt-instance

ganttRef.current.instance.selectRow(...)

Post by Gantt_user »

mats wrote: Mon May 10, 2021 10:09 pm

Here's how you access the Gantt instance (remember, the Gantt inherits from the Grid class).
https://bryntum.com/docs/gantt/#guides/integration/react.md#the-native-bryntum-gantt-instance

ganttRef.current.instance.selectRow(...)

That worked.

Thanks


Post by Gantt_user »

mats wrote: Mon May 10, 2021 10:09 pm

Here's how you access the Gantt instance (remember, the Gantt inherits from the Grid class).
https://bryntum.com/docs/gantt/#guides/integration/react.md#the-native-bryntum-gantt-instance

ganttRef.current.instance.selectRow(...)

After invoking that method I noticed the horizontal scroll position gets shifted all the way to the left (beginning of the gantt). Is this by design?


Post by mats »

You should probably pass false as the scrollIntoViewValue.

/**
     * Selects a row (without selecting a cell).
     * @param {Object|Core.data.Model} options A record to select or an config object describing the selection
     * @param {Core.data.Model|String|Number} options.record Record or record id, specifying null will deselect all
     * @param {Grid.column.Column} options.column The column to scroll into view if `scrollIntoView` is not specified as `false`. Defaults to the grid's first column.
     * @param {Boolean} [options.scrollIntoView] Specify `false` to prevent row from being scrolled into view
     * @param {Boolean} [options.addToSelection] Specify `true` to add to selection, defaults to `false` which replaces
     * @fires selectionChange
     * @category Selection
     */
    selectRow({
        record,
        column = this.columns.visibleColumns[0],
        scrollIntoView = true,
        addToSelection = false
    }) {

Or use

gantt.selectedRecord = record;

Post Reply