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 6166307
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T22:18:57+00:00 2026-05-23T22:18:57+00:00

I have a Dojo-DataGrid which is programatically populated as below : var jsonStore =

  • 0

I have a Dojo-DataGrid which is programatically populated as below :

var jsonStore = new dojo.data.ItemFileWriteStore({ url: "json/gaskets.json" });
var layout= [
                { field: "description", width: "auto", name: "Tier/Description", editable:true },
                { field: "billingMethod", width: "auto", name: "Billing Method", editable: true,
                    type: dojox.grid.cells.Select, options: [ '0', '1' ]  },
                { field: "offeringComponents", width: "auto", name: "Offering Component", editable: true,
                    type: dojox.grid.cells.Select, options: [ '0', '1' ] },
                { field: "serviceActivity", width: "auto", name: "Service Activity", editable: true,
                    type: dojox.grid.cells.Select, options: [ '0', '1' ] },
                { field: "hours", width: "auto", name: "Hours" },
                { field: "rate", width: "auto", name: "Rate <br/> (EUR)" },
                { field: "cost", width: "auto", name: "Cost <br/> (EUR)" },
                { field: "price", width: "auto", name: "Price <br/> (EUR)" },
                { field: "gvn", width: "auto", name: "Gvn" }
            ];

            grid = new dojox.grid.DataGrid({
                query: { description: '*' },
                store: jsonStore,
                structure: layout,
                rowsPerPage: 20
            }, 'gridNode');

The options for the field billingMethod (Currently defined as dojox.grid.cells.Select) are hard coded right now, but I would like to get those values dynamically from the backend as JSON. But dojox.grid.cells.Select currently(I am using Dojo 1.5) does not have a option to define a “store”.

I am trying to use dijit.form.FilteringSelect, but this needs a id(of a Div) for its constructor and I cannot specify one as this select box has to go with in the grid, rather than a separate DIV.

Thanks
Sandeep

  • 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-23T22:18:58+00:00Added an answer on May 23, 2026 at 10:18 pm

    Your answer works fine, the issue is that in the combo the user can select A, but once the combo lose the focus, the value 1 will be shown. Some months ago I had the same problem, and I got a solution from KGF on #dojo. The idea is to have a formatter on the cell that just creates a SPAN element, and then it invokes a query over the store to get the label of the selected element and put it on the SPAN. I modified your example to get that working.

    dojo.require("dojo.data.ItemFileWriteStore");
    dojo.require("dojo.data.ItemFileReadStore");
    dojo.require("dojox.grid.cells.dijit");
    dojo.require("dojox.grid.DataGrid");
    dojo.require("dijit.form.Select");
    
    dojo.require('dojox.grid.cells.dijit');
    dojo.require('dijit.form.FilteringSelect');
    
    var grid;
    var jsonStore;
    
    dojo.addOnLoad(function() {
    
        jsonStore = new dojo.data.ItemFileWriteStore({
            data: {
                "identifier": "identify",
                "label": "description",
                "items": [
                    {
                    "identify": 123,
                    "description": "Project Manager"},
                {
                    "identify": 234,
                    "description": "Developer"},
                {
                    "identify": 536,
                    "description": "Developer",
                    "billingMethod":2}
                ]
            }
        });
    
        var myStore = new dojo.data.ItemFileReadStore({
            data: {
                identifier: 'value',
                label: 'name',
                items: [{
                    value: 1,
                    name: 'A',
                    label: 'A'},
                {
                    value: 2,
                    name: 'B',
                    label: 'B'},
                {
                    value: 3,
                    name: 'C',
                    label: 'C'}]
            }
        });
    
          //[kgf] callback referenced by formatter for FilteringSelect cell
          function displayValue(nodeId, store, attr, item) {
            if (item != null) { //if it's null, it wasn't found!
              dojo.byId(nodeId).innerHTML = store.getValue(item, attr);
            }
          }
    
        var layout = [
            {
            field: "identify",
            width: "auto",
            name: "Id 2 Hide",
            hidden: true},
        {
            field: "description",
            width: "auto",
            name: "Tier/Description",
            editable: true},
        {
            field: 'billingMethod',
            name: 'Billing Method',
            editable: true,
            required: true,
            width: '150px',
            type: dojox.grid.cells._Widget,
            widgetClass: dijit.form.FilteringSelect,
            widgetProps: {
                store: myStore
            },
            formatter: function(data, rowIndex) { //[kgf]
                //alert("data "+data)
                    var genId = 'title' + rowIndex;
                var store = this.widgetProps.store;
                var attr = "label";
    
                setTimeout(function() {
                    store.fetchItemByIdentity({
                        identity: data,
                        onItem: dojo.partial(displayValue, genId, store, attr)
                    });
                    }, 50);
                //for now return a span with a predetermined id for us to populate.
                return '<span id="' + genId + '"></span>';
            }    
        }
        ];
    
        grid = new dojox.grid.DataGrid({
            query: {
                description: '*'
            },
            store: jsonStore,
            singleClickEdit: true,
            structure: layout,
            rowsPerPage: 20
        }, 'gridNode');
    
        grid.startup();
    
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Dojo Datagrid in one of my pages (which contains more content)
I'm trying to create a DOJO DataGrid populated using a dojo.data.ItemFileReadStore with very simple
I am using dojo datagrid to display my data. When the end user edit
I have a DataGrid that is loaded from an XML data store, all created
I have this code: dojo.declare(City, null, { constructor : function(cityid, cityinfo){ } }); dojo.declare(TPolyline,
I have Aptana installed within Eclipse. I'm working on a project with the dojo
Have just started using Visual Studio Professional's built-in unit testing features, which as I
I have a combo box and a datagrid in my page. when the user
We have a situation where we need to display data from a database in
I am struggling with a simple dojo datagrid in my Zend Framework project. I

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.