Dojo EnhancedGrid editable problem

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

Dojo EnhancedGrid editable problem

hery
Hi, I'm having problem with making my dojo EnhancedGrid editable. Currently, I can double click the grid cells and I can change the value, but the moment I press enter again or try to leave the cells (i.e. to save the new value to the grid), I received the "assertion failed in ItemFileWriteStore" error in my firebug.

Below is my source code:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
    <head>
    <style type="text/css"> body, html { font-family:helvetica,arial,sans-serif; font-size:90%; } </style>    <link rel="stylesheet" type="text/css" href="http://ajax.googleapis.com/ajax/libs/dojo/1.5/dijit/themes/claro/claro.css" />
    <style type="text/css"> @import "http://ajax.googleapis.com/ajax/libs/dojo/1.5/dojox/grid/resources/Grid.css"; @import "http://ajax.googleapis.com/ajax/libs/dojo/1.5/dojox/grid/resources/claroGrid.css"; .dojoxGrid table { margin: 0; } </style>    <script src="http://ajax.googleapis.com/ajax/libs/dojo/1.5/dojo/dojo.xd.js" djConfig="parseOnLoad: true"> </script>
    <script type="text/javascript"> dojo.require("dojox.grid.EnhancedGrid"); dojo.require("dojo.data.ItemFileWriteStore"); dojo.require("dojox.grid.cells._base"); dojo.addOnLoad(function() { var layoutabc = [[ { field: "title", name: "TitleofMovie", width: "300px", editable: true }, { field: "year", name: "Year", width: "200px", editable: true }, { field: "producer", name: "Producer", width: "auto", editable: true, type: dojox.grid.cells.Cell } ]]; var mystore = new dojo.data.ItemFileWriteStore({ url: "movies.json" }); // create a new grid: var grid = new dojox.grid.EnhancedGrid( { query: {}, store: mystore, structure: layoutabc }, document.createElement("div") ); dojo.byId("gridDiv").appendChild(grid.domNode); grid.startup(); }); </script></head>

<body class="claro">
    <div id="gridDiv" style="width: 800px; height: 400px;">
    </div>
</body>

And this is the content of my movies.json (the content of data is weird, I know):

{
    items:
    [
        {
            title: "Africa",
            year: "continent",
            producer: "Katia Lund"
        },
        {
            title: "Kenya",
            year: "country",
            producer: "Christine Jeffs"
        },
        {
            title: "Mombasa",
            year: "city",
            producer: "Ridley Scott"
        }
    ]
}
Reply | Threaded
Open this post in threaded view
|

Re: Dojo EnhancedGrid editable problem

hery
Additional info: If I changed to use DataGrid instead of EnhancedGrid, then the whole thing works...
Reply | Threaded
Open this post in threaded view
|

Re: Dojo EnhancedGrid editable problem

hery
I think this can be considered a bug because once I changed to use DataGrid, it works right away.
Can someone help me to report this as a bug?
I can't login into the trac website to submit it myself because I don't have an account and don't see a register link anywhere.
Reply | Threaded
Open this post in threaded view
|

Re: Dojo EnhancedGrid editable problem

Simon Speich
Login: http://trac.dojotoolkit.org/login I'm not sure, but your dojotoolkit (same as for forums) user might be enough, otherwise:
Register http://my.dojofoundation.org/ 
Reply | Threaded
Open this post in threaded view
|

Re: Dojo EnhancedGrid editable problem

hery
In reply to this post by hery
Problem solved. Turns out I need to define the "plugins" attribute for the EnhancedGrid object even though it is just an empty object. Once that is defined it works properly.
Reply | Threaded
Open this post in threaded view
|

Re: Dojo EnhancedGrid editable problem

hery
In reply to this post by Simon Speich
I registered in the dojo foundation and now it works! Thanks, I will report this bug.
Reply | Threaded
Open this post in threaded view
|

Re: Dojo EnhancedGrid editable problem

BradyZhu
This post has NOT been accepted by the mailing list yet.
In reply to this post by hery
One question regarding Dojo grid.

Previously, I use 'dojox.grid.DataGrid' and make one of cells editable by configuring 'editable: true' in specified cell, then it works correctly.

Since now the feature of pagination is required in my grid, I use 'dojox.grid.EnhancedGrid' instead of 'dojox.grid.DataGrid' to construct a grid and make the same config on the cell, but now this cell cannot be editable, my code fragment would be like:

var grid = new dojox.grid.EnhancedGrid({ id: 'grid', store: store, rowSelector: '20px', structure: [[ { name: "price", field: "editLoad", width: "15%", editable: true}] ]....

Note that the 'store' is dojox.data.QueryReadStore.

I was wondering if anyone out there gives me some helps. Thanks in advance!
Reply | Threaded
Open this post in threaded view
|

Re: Dojo EnhancedGrid editable problem

hery
This post has NOT been accepted by the mailing list yet.
I am not sure if this will work for you, but you should try my solution, passing the 'plugins' attribute to the object that you pass to the EnhancedGrid constructor even if it is empty object. Something like this:

var grid = new dojox.grid.EnhancedGrid({ id: 'grid', store: store, rowSelector: '20px', plugins: { }, structure: [[ { name: "price", field: "editLoad", width: "15%", editable: true}] ]

I am not sure if this will fix your problem as this question (and my solution) was posted quite a long time ago.


On Thu, Jan 5, 2012 at 12:16 PM, BradyZhu [via Dojo Toolkit] <[hidden email]> wrote:
One question regarding Dojo grid.

Previously, I use 'dojox.grid.DataGrid' and make one of cells editable by configuring 'editable: true' in specified cell, then it works correctly.

Since now the feature of pagination is required in my grid, I use 'dojox.grid.EnhancedGrid' instead of 'dojox.grid.DataGrid' to construct a grid and make the same config on the cell, but now this cell cannot be editable, my code fragment would be like:

var grid = new dojox.grid.EnhancedGrid({ id: 'grid', store: store, rowSelector: '20px', structure: [[ { name: "price", field: "editLoad", width: "15%", editable: true}] ]....

Note that the 'store' is dojox.data.QueryReadStore.

I was wondering if anyone out there gives me some helps. Thanks in advance!


If you reply to this email, your message will be added to the discussion below:
http://dojo-toolkit.33424.n3.nabble.com/Dojo-EnhancedGrid-editable-problem-tp2083399p3633878.html
To unsubscribe from Dojo EnhancedGrid editable problem, click here.
NAML

Reply | Threaded
Open this post in threaded view
|

Re: Dojo EnhancedGrid editable problem

BradyZhu
This post has NOT been accepted by the mailing list yet.
Great thanks for your reply!

Actually, I have a plugins in my  EnhancedGrid object which is pagination plugin. Just now I knew the root cause for my issue, is that I use a none-writable store  dojox.data.QueryReadStore as grid's store so that grid cannot be edited. And the reason why I use  QueryReadStore   is that this store supports server-side pagination.

I will research all available stores in Dojo and find a store that can both supports server-side pagination and cell editing.

Thanks.

On Thu, Jan 5, 2012 at 5:14 PM, hery [via Dojo Toolkit] <[hidden email]> wrote:
I am not sure if this will work for you, but you should try my solution, passing the 'plugins' attribute to the object that you pass to the EnhancedGrid constructor even if it is empty object. Something like this:

var grid = new dojox.grid.EnhancedGrid({ id: 'grid', store: store, rowSelector: '20px', plugins: { }, structure: [[ { name: "price", field: "editLoad", width: "15%", editable: true}] ]

I am not sure if this will fix your problem as this question (and my solution) was posted quite a long time ago.


On Thu, Jan 5, 2012 at 12:16 PM, BradyZhu [via Dojo Toolkit] <[hidden email]> wrote:
One question regarding Dojo grid.

Previously, I use 'dojox.grid.DataGrid' and make one of cells editable by configuring 'editable: true' in specified cell, then it works correctly.

Since now the feature of pagination is required in my grid, I use 'dojox.grid.EnhancedGrid' instead of 'dojox.grid.DataGrid' to construct a grid and make the same config on the cell, but now this cell cannot be editable, my code fragment would be like:

var grid = new dojox.grid.EnhancedGrid({ id: 'grid', store: store, rowSelector: '20px', structure: [[ { name: "price", field: "editLoad", width: "15%", editable: true}] ]....

Note that the 'store' is dojox.data.QueryReadStore.

I was wondering if anyone out there gives me some helps. Thanks in advance!


If you reply to this email, your message will be added to the discussion below:
http://dojo-toolkit.33424.n3.nabble.com/Dojo-EnhancedGrid-editable-problem-tp2083399p3633878.html
To unsubscribe from Dojo EnhancedGrid editable problem, click here.
NAML




If you reply to this email, your message will be added to the discussion below:
http://dojo-toolkit.33424.n3.nabble.com/Dojo-EnhancedGrid-editable-problem-tp2083399p3634283.html
To unsubscribe from Dojo EnhancedGrid editable problem, click here.
NAML



--
Regards
Brady Zhu