Our blazing fast Grid component built with pure JavaScript


Post by nikko.joson »

Record name/display is not updated when the grid records are updated. I even added a console log on the .add() but the grid display and console log does not update and console log for formatting the name is not re-called.

how can i implement a refresh for each record updated or like resumerefresh() to refresh the grid.


Post by mats »

Sounds like you have not defined your Model correctly, did you add fields? Please provide code and we'll help you find the error.


Post by nikko.joson »

here is the model im using for the store for my grid.

TaskStore extends EventStore {
    static get defaultConfig() {
        return {
            modelClass: Task
        };
    }
};

is this enough?


Post by nikko.joson »

class Task extends EventModel {
    static get defaults() {
        return {
            // in this demo, default duration for tasks will be hours (instead of days)
            durationUnit : 'h'
        };
    }
}

this is the Task model


Post by nikko.joson »

class Pooltech extends Grid {
    static get defaultConfig() {
        return {
            columns: [{
                text: 'meetings',
                flex: 1,
                field: 'name',
                editor: false,
                htmlEncode: false,
                renderer: (data) => `${data.record.name}`
            }, {
                text: 'Timeslot',
                width: 50,
                align: 'left',
                editor: false,
                field: 'timeslot',
                renderer: ((data) => {
                        return data.record.rawData.planningInfo.timeslot.name;
                })
            }],
            rowHeight: 30,
            emptyText: ''
        };
    }

   // constructor here

};

Post by mats »

Still not seeing full picture. The store you use for the grid needs to have ”modelClass” set to a model which defines the fields you want to show / edit


Post by nikko.joson »

@mats my 2nd code snippet is my model, that's the only content i have, now i added this for the name field, but still the same result

static get fields() {
        return [
                {name: 'name', type: 'string'}
        ]
}

Post by Maxim Gorkovsky »

Hello.
I'm afraid code snippets you are posting here do not paint full picture. I see you declared TaskStore and Task model here. I can only assume you instantiate correct store when you pass it to the Grid, smth like:

new Pooltech({
  store : new TaskStore({...})
})

So far it seems that you do not use the store instance. Please add missing code here.


Post Reply