Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Grid should accept async renderCell functions #139

Open
AllNamesRTaken opened this issue Mar 30, 2012 · 4 comments
Open

Grid should accept async renderCell functions #139

AllNamesRTaken opened this issue Mar 30, 2012 · 4 comments

Comments

@AllNamesRTaken
Copy link

It would help immensely if the grid would accept renderCell functions that return deferreds. Then we could maybe have async rendering of components in the grid.

this code in Grid.js

}else if(column.renderCell){
// A column can provide a renderCell method to do its own DOM manipulation,
// event handling, etc.
appendIfNode(td, column.renderCell(object, data, td, options));

could maybe be something like:

}else if(column.renderCell){
cell = column.renderCell(object, data, td, options);
if(cell.then)
cell.then(function(node) { appendIfNode(td, node); });
else
// A column can provide a renderCell method to do its own DOM manipulation,
// event handling, etc.
appendIfNode(td, cell);

And of course the same in the other places where renderCell or renderHeadercell is used.

//J

@AllNamesRTaken
Copy link
Author

Same for Editor.js.
Instead of having a synchronous function that creates the editor using the new keyword and expecting that to set up the domNode and get all dependencies synchronously, we could be allowed to supply an async function that returns an instance of the widget (or widget-like class) in its promise. The the rest of the wiring could proceed as normal.

This would allow things such as IoC instanciation of controls with dependency injection.

//J

@mikerobi
Copy link

In my application, a very small percentage of cells are very expensive to compute, rendering them asynchronously will significantly decrease the load time of the rest of the grid.

However, I am not convinced that this needs to be built in to the dgrid. My original plan was to have renderCell insert a loading indicator and generate a closure that will be used to asynchronously update the cell.

@PunkChameleon
Copy link
Contributor

👍 Any news on this? It'd be great to be able to use deferred objects in formatter or renderCell

@Lumina83
Copy link

Yeah that would be great.
I am updating from Dojo 1.6 to 1.9 and want to use dgrid now. We are working a lot with deferred Objects and now I can't use my old formatter-functions in the new dgrid. :-(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants