[Dojo-interest] DataGrid checkbox unable to check

431 views
Skip to first unread message

dhinged

unread,
May 18, 2010, 12:52:05 PM5/18/10
to dojo-i...@mail.dojotoolkit.org

I have a dojox.grid.DataGrid cell that has a cell type of
dojox.grid.cells.Bool, and I can uncheck the box, but I'm unable to check
it. These are the table header options (th):

field="checkBox" cellType="dojox.grid.cells.Bool"
editable="true" alwaysEditing="true" values="1,0"
--
View this message in context: http://dojo-toolkit.33424.n3.nabble.com/DataGrid-checkbox-unable-to-check-tp826853p826853.html
Sent from the Dojo Toolkit mailing list archive at Nabble.com.
_______________________________________________
FAQ: http://dojotoolkit.org/support/faq
Book: http://docs.dojocampus.org
Dojo-i...@mail.dojotoolkit.org
http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest

--
You received this message because you are subscribed to the Google Groups "dojo-interest" group.
To post to this group, send email to dojo-i...@googlegroups.com.
To unsubscribe from this group, send email to dojo-interes...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/dojo-interest?hl=en.

Elvis Wang

unread,
May 19, 2010, 5:32:24 AM5/19/10
to dojo-i...@mail.dojotoolkit.org, wan...@cn.ibm.com

This is weird, are you using a writable store? Below is a test case, it works well, you might take a look.

<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"></meta>
    <style type="text/css">
        @import "../resources/Grid.css";
        @import "../resources/tundraGrid.css";
        @import "../../../dojo/resources/dojo.css";
        @import "../../../dijit/themes/tundra/tundra.css";
    </style>
    <script type="text/javascript" src="../../../dojo/dojo.js" djConfig="isDebug:true, parseOnLoad: true"></script>
    <script type="text/javascript">
        dojo.require("dijit.dijit");
        dojo.require("dojox.grid.DataGrid");
        dojo.require("dojox.grid.cells.dijit");
        dojo.require("dojo.data.ItemFileWriteStore");
        dojo.require("dojo.parser");
       
        data = {
            identifier: 'id',
            label: 'id',
            items: [
                { id: 1, col1: "normal", col2: false},
                { id: 2, col1: "important", col2: false},
                { id: 3, col1: "important", col2: false},
                { id: 4, col1: "note", col2: true},
                { id: 5, col1: "normal", col2: true },
                { id: 6, col1: "important", col2: false },
                { id: 7, col1: "note", col2: true }
            ]
        };
        test_store = new dojo.data.ItemFileWriteStore({data: data});
    </script>
</head>
<body class="tundra">
    <table dojoType="dojox.grid.DataGrid"
        jsid="grid" id="grid"
        store="test_store" query="{ col1: '*' }" rowsPerPage="20" rowSelector="20px">
        <thead>
            <tr>
                <th field="col1" width="200px">Column 1</th>
                <th field="col2" width="auto" cellType="dojox.grid.cells.Bool" editable="true" alwaysEditing="true">Column 2</th>
            </tr>
        </thead>
    </table>
</body>
</html>

tridem-dojo

unread,
Sep 29, 2010, 4:12:28 AM9/29/10
to dojo-i...@mail.dojotoolkit.org

Same problem programatically:


editable: true,
alwaysEditing: true,
type: dojox.grid.cells.Bool,
values: [ "1", "0" ]


IFWS and other components are correct, using Dojo 1.5.
--
View this message in context: http://dojo-toolkit.33424.n3.nabble.com/DataGrid-checkbox-unable-to-check-tp826853p1600941.html

tridem-dojo

unread,
Sep 29, 2010, 5:01:08 AM9/29/10
to dojo-i...@mail.dojotoolkit.org

I'm getting closer to the "problem". When using dojox.grid.cells.Bool you
must use true or false not 0 or 1. Then it will work fine.
But even then I can't find an event that fires onChange / applyEdit - any
ideas?

I also tried dojox.grid.cells.Ceckbox with alwaysEditing set to true.
But only one checkbox will appear, the other rows do not have one unless I
double click to edit.

Strange behaviours, don't you think?!
--
View this message in context: http://dojo-toolkit.33424.n3.nabble.com/DataGrid-checkbox-unable-to-check-tp826853p1601148.html

tridem-dojo

unread,
Sep 29, 2010, 5:03:34 AM9/29/10
to dojo-i...@mail.dojotoolkit.org

tridem-dojo

unread,
Sep 29, 2010, 6:04:12 AM9/29/10
to dojo-i...@mail.dojotoolkit.org

tridem-dojo wrote:
>
> I'm getting closer to the "problem". When using dojox.grid.cells.Bool you
> must use true or false not 0 or 1. Then it will work fine.
> But even then I can't find an event that fires onChange / applyEdit - any
> ideas?
>

Using methods like apply, applyEdit, onChange or even setValue never seem to
fire when changing the checkbox. Only when "leaving the row" the apply
callback was fired.

The only method to react on the "always and direct editing" is the onSet
connection directely to the store, f.e.:

dojo.connect(myStore, 'onSet', updateGrid);

function updateGrid(item, attribute, oldValue, newValue) {
console.log("Item: [" + store.getLabel(item) + "] was changed.
Attribute: [" + attribute + "] old value: [" + oldValue + "] new value: [" +
newValue + "]");

if (oldValue == newValue) {
return;
}
}

--
View this message in context: http://dojo-toolkit.33424.n3.nabble.com/DataGrid-checkbox-unable-to-check-tp826853p1601406.html

Reply all
Reply to author
Forward
0 new messages