Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1088623
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T23:05:44+00:00 2026-05-16T23:05:44+00:00

I have a grid that will edit small chunks of data based on a

  • 0

I have a grid that will edit small chunks of data based on a larger tree structure. In order to make it easier to know what’s being saved by the user, I want to have the grid be in a non-editable state when the user first sees the grid. When the user is ready, they can click the edit button, which will make portions of the grid editable. Then, there is a save or a cancel button to either save the changes or revert back.

For the most part it works. However, if you click edit, don’t change anything, click save, and then click edit again, you cannot edit the data in the grid, and on some occasions you receive an “assertion failed in ItemFileWriteStore” message. This also happens if you click on the cancel button. Occasionally, all the data in the grid will disappear after clicking the cancel button as well.

Below, I’ve included the smallest chunk of code that reproduces the problem I’m seeing. Has anyone outer there seen this issue and been able to fix it, or am I doing something wrong in my code that is causing this particular problem?

Thanks.

<html>
  <head>
    <title>Dojo Grid Test</title>
    <script src="http://ajax.googleapis.com/ajax/libs/dojo/1.4/dojo/dojo.xd.js" type="text/javascript"></script>

    <link rel="stylesheet" type="text/css" href="http://ajax.googleapis.com/ajax/libs/dojo/1.4/dijit/themes/tundra/tundra.css" />
    <link rel="stylesheet" type="text/css" href="http://ajax.googleapis.com/ajax/libs/dojo/1.4/dojox/grid/resources/Grid.css">
    <link rel="stylesheet" type="text/css" href="http://ajax.googleapis.com/ajax/libs/dojo/1.4/dojox/grid/resources/tundraGrid.css">

    <script>

      dojo.require("dojo.data.ItemFileWriteStore")
      dojo.require("dojox.grid.cells.dijit");
      dojo.require("dojox.grid.DataGrid");
      dojo.require("dojox.grid.cells");

      var attCodeStore = null;
      var containerGrid = null;

      function editTable() {
          var theStructure = containerGrid.structure;
          theStructure[1].editable = true;
          theStructure[2].editable = true;
          containerGrid.setStructure(theStructure);
          toggleButtons();
      }

      function saveTable() {
          var theStructure = containerGrid.structure;
          theStructure[1].editable = false;
          theStructure[2].editable = false;
          containerGrid.setStructure(theStructure);
          attCodeStore.save();
          toggleButtons();
      }

      function cancelTable() {
          var theStructure = containerGrid.structure;
          theStructure[1].editable = false;
          theStructure[2].editable = false;
          containerGrid.setStructure(theStructure);
          attCodeStore.revert();
          toggleButtons();
      }

      function toggleButtons() {
          if (dojo.hasClass("editButton", "dijitHidden")) {
              dojo.removeClass("editButton", "dijitHidden");
              dojo.addClass("saveButton", "dijitHidden");
              dojo.addClass("cancelEditButton", "dijitHidden");
          } else {
              dojo.addClass("editButton", "dijitHidden");
              dojo.removeClass("saveButton", "dijitHidden");
              dojo.removeClass("cancelEditButton", "dijitHidden");
          }
      }

      function setupTable() {

        var attCodeData = {label:'attribute',
                           identifier: 'id',
                            items: [
                                { id:'itemOneId',
                                  alias:'itemOneAlias',
                                  description:'itemOneDescription',
                                  attribute:'itemOneAttribute'
                                },
                                { id:'itemTwoId',
                                  alias:'itemTwoAlias',
                                  description:'itemTwoDescription',
                                  attribute:'itemTwoAttribute'
                                },
                                { id:'itemThreeId',
                                  alias:'itemThreeAlias',
                                  description:'itemThreeDescription',
                                  attribute:'itemThreeAttribute'
                                },
                                { id:'itemFourId',
                                  alias:'itemFourAlias',
                                  description:'itemFourDescription',
                                  attribute:'itemFourAttribute'
                                },
                              ]
                            };

        attCodeStore = new dojo.data.ItemFileWriteStore({data:attCodeData})

        console.log(attCodeStore);
        console.log(attCodeData);

        containerGrid = new dojox.grid.DataGrid({
                      store: attCodeStore,
                      clientSort: true,
                      autoHeight: true,
                      structure: [
                          {field: 'attribute', width: '100px', name: 'Attribute'},
                          {field: 'alias', width: '100px', name: 'Alias'},
                          {field: 'description', width: 'auto', name: 'Description'}
                      ]
                  });

        dojo.byId("gridDiv").appendChild(containerGrid.domNode);
        containerGrid.startup();
      }

      dojo.addOnLoad(function(){
         setupTable();  
      })
    </script>
  </head>
  <body>
     <div id="gridArea">
          <div>
              <input type="button" value="Edit" id="editButton" onclick="editTable()"/>
              <input type="button" value="Save" id="saveButton" onclick="saveTable()" class="dijitHidden"/>
              <input type="button" value="Cancel" id="cancelEditButton" onclick="cancelTable()" class="dijitHidden" />
          </div>
      </div>
      <div id="gridDiv"></div>
  </body>
</html>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T23:05:46+00:00Added an answer on May 16, 2026 at 11:05 pm

    Figured this one out (though it took a bit). Turns out, that when you click on an entry in an editable grid, the grid goes into an editing state. (Makes sense.) However, when I saved the data store while the grid was in an editing state, it didn’t change the state of the grid. The next time I clicked on edit and brought the grid back to where I thought I could start editing, the grid thought it was still editing the previously selected cell, and would only send that cells information.

    When I put the following code at the beginning of my saveTable and cancelTable methods, all worked as expected:

    if (containerGrid.edit.isEditing()) {
         containerGrid.edit.apply();
    }
    

    Hopefully, this answer can save someone else some time later.

    Thanks.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.