Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Accesing nested json attributes from dgrid editor #234

Open
tsemachh opened this issue Jul 19, 2012 · 1 comment
Open

Accesing nested json attributes from dgrid editor #234

tsemachh opened this issue Jul 19, 2012 · 1 comment

Comments

@tsemachh
Copy link

Hi
I got a Json Array which has some of the attributes nested , after small changes I applied I managed to support it all the way from the Json to the Widget and back to the Store.
Main change is to work with dojo.get /set Object to get nested access to nested json attributes
It will be good to have it as regular Dojox Grid doesn't support it due to the old Store Usage.

Changes in Summary:

  1. dgrid/_StoreMixin.js‬
    updateDirty: function(id, field, value){
    From:
    dirtyObj[field] = value;
    To:
    dojo.setObject(field, value,dirtyObj);
  2. dgrid/editor.js
    function edit(cell) {
    From:
    value = (dirty && field in dirty) ? dirty[field] :
    column.get ? column.get(row.data) : row.data[field];
    To:
    value = (dirty && field in dirty) ? dirty[field] :
    column.get ? column.get(row.data) : dojo.getObject(field,false,row.data);
  3. dgrid/Grid.js
    renderRow: function(object, options){
    From:
    }else if("field" in column && column.field != "_item"){
    data = data[column.field];
    To:
    }else if("field" in column && column.field != "_item"){
    data = dojo.getObject(column.field,false,data);

cheers
Tsemach.

@gerpres
Copy link

gerpres commented Mar 11, 2013

+1 for this.
accessing nested attributes would be very useful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants