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

Dojo 1.10 dojox/mobile/Switch not rendering inside a grid #958

Closed
Rubbinio opened this issue Jun 17, 2014 · 1 comment
Closed

Dojo 1.10 dojox/mobile/Switch not rendering inside a grid #958

Rubbinio opened this issue Jun 17, 2014 · 1 comment

Comments

@Rubbinio
Copy link

With the changes done to the dojox/mobile/Switch for 1.10 under Issue #15076 (https://bugs.dojotoolkit.org/ticket/15076) the witch does not render anymore when placed as an always on editor inside a cell.

Changes done to Switch: dojo/dojox@5cfae8a

The problem comes from the fact that when the startup gets called, the dimensions are 0px and all the calculations the resize does become invalid and so does the css generated.

We also created a wrapper similar to editor to insert widgets in the cells and we are calling the widget startup during renderCell similar to what editor does.

Neither one of those approaches works anymore with the 1.10 Switch.

If you wrap the startup from renderCell in a timeout then the Switch renders fine

setTimeout(lang.hitch(this, function() {
     if (widgetInstance && !widgetInstance._destroyed) {
           widgetInstance.startup();
      }
}));

The renderCell from our widgetWrapper based on dgrid/editor

column.renderCell = function(object, value, cell, options) {
            var grid = column.grid;
            var args = widgetArgs;
            if (typeof args == "function") {
                args = args.call(grid, column, object, value);
            }

            var widgetInstance = cell.widgetInstance = new Widget(args);

            var row = grid.row(object);
            widgetCache[row.id] = widgetInstance;

            widgetInstance.placeAt(cell);

            if (!widgetInstance._started) {
                widgetInstance.startup();
            } 
        };
@kfranqueiro
Copy link
Member

Thanks for pointing this out. This is likely happening because when insertRow is called via renderArray, the widget doesn't end up within the document flow immediately, but rather after all of the insertRow calls finish. The setTimeout ends up resolving that since then startup only gets called after the rows have been inserted into the document.

While the setTimeout will certainly work, we'll have to investigate whether we can come up with something more efficient, since setting N timeouts on every renderArray call seems less than ideal.

@ghost ghost closed this as completed in ee184bf Aug 4, 2014
ghost pushed a commit that referenced this issue Aug 4, 2014
This issue was closed.
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

2 participants