Our blazing fast Grid component built with pure JavaScript


Post by mats »

Not following, can you please provide a test case showing what doesn't work for you?


Post by gregc »

Not sure what the import would be on your examples page, but the issue starts like this:

new Grid({
    appendTo : 'container',
    columns  : [
        { text : 'Date where is my time', field : 'start', flex : 1, type : 'date', editor: 'datetimefield', format : 'DD-MMM-YYYY HH:mm' }
    ],

data : [
    { start : '2021-01-09T14:15:00Z' }
]
});

Post by mats »

And what's the problem faced? Does your model define a 'start' field with type 'date'? https://bryntum.com/docs/scheduler/#Core/data/field/DateDataField


Post by gregc »

The issue is if you paste above as an example, the editor doesnt work and the time is not displayed.

Well to date I've never had to create a custom model (except for the advanced gantt example). I just assumed that the column looks at my json and auto created the model properties, converting it to the type as needed. So it would convert it to a date.

And it does, and it works fine, but it converts it to a date that is only a date, you used the above and the editor does not work, throws errors.

I guess I was really hoping that the date type worked with datetimefield out the box, but if not minor changes needed to make it work,


Post by mats »

You should definitely define fields, there's no way we can know what's a date and what's a string I'm afraid. This is the proper way:

import Grid from '../../lib/Grid/view/Grid.js';
import '../../lib/Grid/column/DateColumn.js';
import '../../lib/Core/widget/DateTimeField.js';

new Grid({
    appendTo : 'container',
    columns  : [
        { text : 'Date where is my time', field : 'start', flex : 1, type : 'date', editor : 'datetimefield', format : 'DD-MMM-YYYY HH:mm' }
    ],

store : {
    fields : [
        { type : 'date', name : 'start' }
    ]
},

data : [
    { start : '2021-01-09T14:15:00Z' }
]
});

Post by gregc »

I see, the store doesn't know about the columns, hence date needed in its definition. It works now, thanks!


Post Reply