Hi
I’m trying to add a button to a CompList or grid and am having issues with not being able to click on the buttons. I’ve tried the two following approaches
This is using a grid and then creating buttons as needed in a custom ViewProvider
 
            var grid = new zebra.ui.grid.Grid([
                [“Text Cell”, true, “Text cell”],
                [“Text Cell”, false, “Text cell”],
                [“Text Cell”, true, “Text cell”],
                [“Text Cell”, false, “Text cell”],
                [“Text Cell”, true, “Text cell”]
            ]);
            grid.setViewProvider(new zebra.ui.grid.DefViews([
                function getView(target, row,  col,  obj) {
                    if(col == 0)
                        return new zebra.ui.CompRender(new zebra.ui.Label(obj));
                    else
                        return new zebra.ui.CompRender(new zebra.ui.Button(“Up”));
                }
           ]));
 
The other method adds a panel to a CompList the panel contains a label and buttons
 
            var list =  new zebra.ui.CompList();
            panel.add(85, new zebra.ui.ScrollPan(list, zebra.layout.VERTICAL));
            var labels = [“hello”, “good bye”, “hi”];
            for(var i=0; i<labels.length; i++) {
                var panel = new zebra.ui.Panel();
                panel.mousePressed = function(e)  { console.log(“Panel mouse”); };
                panel.setLayout(new zebra.layout.PercentLayout(zebra.layout.HORIZONTAL, 2, true));
                panel.add(50, new zebra.ui.Label(labels[i]));
                var moveup = new zebra.ui.Button(“\u2B06″);
                moveup.mousePressed = function(e)  { console.log(“Up mouse”); };
                panel.add(50, moveup);
                moveup.bind(function (src) {
                    console.log(“Up”);
                });
                 list.add(panel);
            }
 
In both cases the button events do not fire, the hover state is also not triggered on the buttons.
So my question is, is it possible to click a button in a CompList embedded in a ScrollPan?
 
Any help is much appreciated.
Tom
 
 
 

Please login or Register to Submit Answer