Our blazing fast Grid component built with pure JavaScript


Post by zaclangley »

I've been trying to implement your date picker component from the example:
https://www.bryntum.com/examples/grid/columntypes/

I understand that the source code is available in the .zip file provided in the trial, but it is all uglified and unreadable.

I've been having an issue, is it possible for you to provide the source code for that example. I just need a jump start to get my implementation running.

Post by mats »

Here's the code for the sample:
import '../_shared/shared.js'; // not required, our example styling etc.
import '../../lib/Grid/column/CheckColumn.js';
import '../../lib/Grid/column/DateColumn.js';
import '../../lib/Grid/column/RatingColumn.js';
import '../../lib/Grid/column/PercentColumn.js';
import '../../lib/Grid/column/RowNumberColumn.js';
import '../../lib/Grid/column/TemplateColumn.js';
import '../../lib/Grid/column/WidgetColumn.js';
import '../../lib/Common/helper/WidgetHelper.js';
import Grid from '../../lib/Grid/view/Grid.js';
import DataGenerator from '../../lib/Common/helper/util/DataGenerator.js';

new Grid({

    appendTo : 'container',

    minHeight : '20em',

    selectionMode : {
        row      : true,
        checkbox : true
    },

    columns : [
        { type : 'rownumber' },
        {
            text     : 'Template',
            field    : 'name',
            flex     : 1,
            type     : 'template',
            template : data => `Hi ${data.record.data.name}!`
        },
        { text : 'Percent', field : 'percent', flex : 1, type : 'percent' },
        {
            text    : 'Widget',
            field   : 'age',
            width   : 100,
            type    : 'widget',
            widgets : [{
                type     : 'button',
                icon     : 'b-fa b-fa-plus',
                cls      : 'b-blue b-raised',
                onAction : ({ source : btn }) => {
                    btn.cellInfo.record.age++;
                }
            }]
        },
        { text : 'Date', field : 'start', flex : 1, type : 'date', format : 'MMMM Do YYYY' },
        {
            text     : 'Link',
            field    : 'name',
            type     : 'template',
            editor   : false,
            template : data => `<a href="//www.bryntum.com" target="_blank">Click me</a>!`
        },
        {
            type    : 'rating',
            text    : 'Rating',
            cellCls : 'satisfaction',
            max     : 5,
            field   : 'rating'
        }
    ],

    data : DataGenerator.generateData(50)
});

Post Reply