Opened 11 years ago

Closed 11 years ago

#7474 closed defect (wontfix)

regression: Grid 1.2 offers no more methods to get/add a Row

Reported by: remi Owned by: Bryan Forbes
Priority: high Milestone: 1.2
Component: DojoX Grid Version: 1.1.1
Keywords: Grid, regression Cc:
Blocked By: Blocking:

Description (last modified by bill)

With Grid 1.0 a simple selection.getSelected() has delivered a list of items, which could be used to move a complete row from one Grid to another.

Example:

var s = leftGrid.selection.getSelected();
if(s.length) {
    rightGrid.beginUpdate();
    for (var i = 0; i < s.length ; i++) {
        rightGrid.addRow(leftGrid.model.getRow(s[i]));
    }
    rightGrid.endUpdate();

    leftGrid.model.remove(s);
    leftGrid.selection.clear();
}

With Grid 1.2 the model is gone, but also the getRow and addRow methods. Instead, selection.getSelected() returns a array of the underlying datastore. The problem is, that the returned data format of selection.getSelected() now depends on the specific (!) datastore implementation.

There are no methods anymore, to get the content of a row in an applicable data format (for example for calling newItem(), since addRow is gone). Using the result of selection.getSelected() is not possible, because of the incompatible data format of the underlying datastore (for example the data format of a ItemFileWriteStore?).

Remi

Change History (3)

comment:1 Changed 11 years ago by bill

Description: modified (diff)

I wouldn't call this a regression... it's just that (IIUC) the operation you are talking about now needs to be done on the data stores feeding the new grid and old grid, specifically creating a new item (in the target table) and deleting the old item (in the source table).

You shouldn't be looking at an item directly; access it through the store's interface. On your old store, do getAttributes() and then loop through each attribute and getValue(item, attribute), constructing a new item to insert into the new store.

comment:2 Changed 11 years ago by remi

Hi Bill,

thank you very much for your idea. I've tested your solution and it works. But if it's possible to iterate through the datastore items from the outside, then it should also be possible to offer the old getRow and addRow as helper methods for the Grid 1.2 users. This will increase the comfort for Grid users.

Regarding to the question, if this is a regression or not: If you search through dojotoolkit.org, you'll find 3 book pages and round about 11 forum threads with hints to use getRow and it's nearly the same with addRow. As a consequence you will find some solutions out there, which uses these two methods with Grid 1.1. If these functions aren't available anymore in Grid 1.2, then I'm sure that this is not only a regression in my eyes, but also in the eyes of other users (they have to code it by themselves).

So, please can we get the getRow and addRow methods back in the Grid 1.2?

comment:3 Changed 11 years ago by Bryan Forbes

Resolution: wontfix
Status: newclosed

All item fetching must be done through the store. The documentation will be updated for the 1.2 release. Closing as "wontfix".

Note: See TracTickets for help on using tickets.