-
Help please. This code doesn't work (for any recid, for example #3):
because (in my opinion) that 'onRefresh' event works BEFORE records array made and completed. And the question is: how to makes it work? In another words, can I make a records changes after they are downloaded from server, but before they will be visible in table? |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 1 reply
-
btw:
works, but this is 'lame horse'. Isn't it? I don't like 'setTimeout'. |
Beta Was this translation helpful? Give feedback.
-
You can modify you function not to be a "lame horse" in the following way onLoad(event) {
event.done(() => {
this.records.forEach(rec => {
rec.department = deparartments[rec.departmentIndex]
})
})
} This will create a field called department which you can render in the column. This presuposes that you already have js array with Also, you can define your own formatter function and then it will auto populate, see https://w2ui.com/web/docs/2.0/w2utils.formatters |
Beta Was this translation helpful? Give feedback.
-
My use case is that the JSON I receive is not the records array it self but rather an object containing the array. To make that work you can override the records array in
|
Beta Was this translation helpful? Give feedback.
You can modify you function not to be a "lame horse" in the following way
This will create a field called department which you can render in the column. This presuposes that you already have js array with
departments
in js. You can load it before grid loads. See https://w2ui.com/web/docs/2.0/utils/eventsAlso, you can define your own formatter function and then it will auto populate, see https://w2ui.com/web/docs/2.0/w2utils.formatters