DropDownButton in the grid - problem with opening menu!

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

DropDownButton in the grid - problem with opening menu!

paweluz
Hi!

I have a grid, to be specific EnhancedGrid, that has 4 coulmns. In the last one I would like to add a DropDownButton with dome menu for example. Actually it would be nice if it could be simple button but that is not mine main problem. Problem is that when I click on the Dropdown button:
- checkbox is checked/ unchecked - depends on his last state
- dropdown menu closes just after click. So I actually can not do anythink with this dropdown.
I took the dropdown from the examples on the DOJO page. My code looks like that:


                var store = new dojox.data.XmlStore({
                    url: 'files/books.xml'
                });

                var layout = [{
                    field: 'name',
                    name: 'Name',
                    width: '50px'

                }, {
                    field: 'color',
                    name: 'Color',
                    width: '55px',
                formatter: function(item) {
                var menu = new dijit.Menu({
                    style: "display: none;"
                });
                var menuItem1 = new dijit.MenuItem({
                    label: "Save",
                    iconClass: "dijitEditorIcon dijitEditorIconSave",
                    onClick: function() {
                        alert('save');
                    }
                });
                menu.addChild(menuItem1);

                var menuItem2 = new dijit.MenuItem({
                    label: "Cut",
                    iconClass: "dijitEditorIcon dijitEditorIconCut",
                    onClick: function() {
                        alert('cut');
                    }
                });
                menu.addChild(menuItem2);

                var button = new dijit.form.DropDownButton({
                    label: "hello!",
                    name: "programmatic2",
                    dropDown: menu,
               
                });
                return button
                       
                }

                }];

                // create a new grid:
                var gridDiv = new dojox.grid.EnhancedGrid({
                    query: {
                        name: '*'
                    },
                    store: store,
                    rowSelector: '0px',
                    structure: layout,
                    autoHeight:true,
                    selectionMode: "multiple",
                    plugins: {
                        nestedSorting: false,
                        dnd: false,
                        indirectSelection: {
                            name: "Selection",
                            width: "50px",
                            styles: "text-align: center;"
                        }
                    }
                }, "gridDiv");

                gridDiv.startup();


Is there some parameter to grid that I can tell that row can be only check by the checkbox and not by the row click. And second think, also very important how come the dopdownmenu closes after click. I think that  menu appears for a 1/5 second and then row selection is done and it somehow closes the menu. What do you think? Maybe this is the wrong way of adding button to grid.

Can anyone please help me on that?

Regards,
Pawel
Reply | Threaded
Open this post in threaded view
|

Re: DropDownButton in the grid - problem with opening menu!

paweluz
Can anyone please help me on that?Any idea would be great. Maybe just what is the other way to put button in the grid?

Regards,
Pawel
Reply | Threaded
Open this post in threaded view
|

Re: DropDownButton in the grid - problem with opening menu!

Evan
In reply to this post by paweluz
Hi Pawel,

Your way of adding widget to Grid is correct - by using formatter.

Selecting a row by clicking anywhere within the row was supposed to be a consistent behavior across various scenario, e.g.
- http://archive.dojotoolkit.org/nightly/dojotoolkit/dojox/grid/tests/test_data_grid_edit_dijit.html
- http://archive.dojotoolkit.org/nightly/dojotoolkit/dojox/grid/tests/test_grid_selectors.html
- http://archive.dojotoolkit.org/nightly/dojotoolkit/dojox/grid/tests/test_edit_keyNav.html

Please feel free to raise ticket on http://bugs.dojotoolkit.org/ if this break any common scenario.

Regarding the DropDownButton, isn't it an expected behavior? - the dropdown menu is closed once blurred, e.g. similar as the 'Type' column in http://archive.dojotoolkit.org/nightly/dojotoolkit/dojox/grid/tests/test_data_grid_edit_dijit.html










Reply | Threaded
Open this post in threaded view
|

Re: DropDownButton in the grid - problem with opening menu!

paweluz
Thank you very much for your help. Regarding dropdownbutton actually I am not able to select any of the item in that menu. When I click on the button menu appears for 1/5 secund, and the automatically hides. I think that this one is caused by row selection mode in grid (I call that row selection mode :) ). So the problem is that I can not select any item from the memu.... That is my problem. You can try to start my code and you will see what I mean...

Can you help me with that? is this a bug?

Regards,
Pawel
Reply | Threaded
Open this post in threaded view
|

Re: DropDownButton in the grid - problem with opening menu!

rkcmick
This post has NOT been accepted by the mailing list yet.
Hello..
I'm encountering this exact same behavior.  Anyone find a way to make it work?
Thanks.
Reply | Threaded
Open this post in threaded view
|

Re: DropDownButton in the grid - problem with opening menu!

paweluz
No I have not found solution yet. I will create a new ticket for that I guess....
Reply | Threaded
Open this post in threaded view
|

Re: DropDownButton in the grid - problem with opening menu!

paweluz
Still do not have solution for that. I have created ticket for that in here: http://bugs.dojotoolkit.org/ticket/12714