DataModel and DataStore equivalencies - Ext JS

Hello, very new to EXT here.

I was setting up some test last week to run yui-ext around the block. With Grid for example, I was able to grab the id (xmlDataModel) which I made meaningful:

grid.on('rowclick', function(grid, rowIndex) {
alert(grid.getDataModel().getRowId(rowIndex));
});

So, then I hear about EXT and 1.0. I have converted my testing rig to 1.0 but am at a loss when it comes to understanding DataStore (DataSource?)

I'm thinking in the neighborhood of:

grid.ds.getAt(rowIndex).ItemAt(id);

Obviosuly, no joy :-)

How would I achieve the equivalent of the above in 1.0 Alpha 2? Or, more generally, how would I access the data in any of the xml fields?


Also, I was able to load a new xml data set into the grid at will, by doing (anywhere on the page):

dm.load('url');

How does one achieve this?

Am I even close: ?

ds.loadData('url');


Lastly, anyone up for consulting? I've never had this much trouble finding paid help before in my life! Good Grief Charlie Brown....

TIA

Paul
  # 2  
02-28-2007, 11:03 PM

maybe this will help:
var ds = grid.getDataSource(); // DataStore
var cm = grid.getColumnModel(); // ColumnModel
var r = ds.getAt(5); // 6-th Record from the DataStore
var colName = cm.getDataIndex(7); // name of the 8-th column from the Record
r.get(colName); // the record you want
  # 3  
02-28-2007, 11:48 PM

Thanks, that worked like a charm.

Correct me if I am wrong, there is no DataStore documentation. I am not complaining, just making sure I am not missing some source of docs for this.

To get at a selected rows data:

var s = sm.getSelected();
var c = cm.getDataIndex(1);
alert(s.get(c));
  # 4  
03-01-2007, 12:17 AM

yep. right now jack's not working on documentation much. more on bugs and features.
until then, we'll just have to dig into the source and rely on this forum for help.

another place to hunt would be the examples folder in the ext-1.0-alpha2.zip file.
there are already some great grid examples in there.

haven't really fiddled with the RowSelectionModel / CellSelectionModel, but from your example you should probably be looking at the CellSelectionModel.
  # 5  
03-07-2007, 11:40 AM

Hi, I have a problem here maybe someone could help :d


I've used @mystix code, I have a PropertyGrid(new for PropsGrid) and after I edited a cell I want to save it in database.

The event function looks like this:

function afterEdit(propsG) {


var dso = propsG.getDataSource();
var cmo = propsG.getColumnModel();

var name = dso.getAt(0).get(cmo.getDataIndex(1));
var d1 = dso.getAt(1).get(cmo.getDataIndex(1));
var d2 = dso.getAt(2).get(cmo.getDataIndex(1));
var d3 = dso.getAt(3).get(cmo.getDataIndex(1));
var d4 = dso.getAt(4).get(cmo.getDataIndex(1));
var d4 = dso.getAt(5).get(cmo.getDataIndex(1));




// update new data
update( name, d1, d2, d3, d4, d5 );
}


The problem is: if I modify the "name" -
var name = dso.getAt(0).get(cmo.getDataIndex(1)); take the old value of name not the new value.

Thanks,
Cosmin.

你可能感兴趣的:(c,xml,ext,UP,yui)