Adding a record when xml is empty? - Ext JS

Hi I am testing it in alpha2:

var condition = new record({
ExternalId: '0',
Name: 'Mostly Shade',
Description: 'a description',
Condition: 'a Condition',
Contex: 'a Context',
AValue: 'a Context',
Attribute: 'a Context',
Operator: 'a Context',
SearchType: 'a Context'
});
ds.insert(0, condition);
gridSearchCondition.startEditing(0, 0);

and work ok when the xml have rows, but don't work (I get error) when the xml is empty, the objects Ext.grid.ColumnModel, Ext.data.Store, Ext.data.XmlReader don't have enough information to detect 0 rows and create a row?

which is the better way to add a row when is empty the xml in ext1?

kind regards
Frank
  # 2  
03-08-2007, 12:59 PM

hi frank, did you find a solution for this problem?
  # 3  
03-08-2007, 05:02 PM

hicker now I was testing using ext1 alpha3 rev2 and it work ok

InsertAddress: function(){

var adataSource = gridAddress.getDataSource();
adataSource.clearFilter();
r = showGridContactAddress.onGetRecord();
var recAddress = new r({
ExternalId: '0',
Flag: '3',
Address1: 'Type an Address ',
Address2: '',
City: '',
Country: '',
County: '',
PostalCode: '',
StateAbbreviation: '',
Zip: '',
AddressType: 'Postal'


});

recAddress.modified = true;
adataSource.insert(0, recAddress);
var Count = adataSource.data.items.length;
gridAddress.startEditing(0, 0);
adataSource.filter('Flag', /[^1]/);//show row different 1

}

I mean I have a grid with 0 rows and I can add a new record, are you test it with alpha3 rev2?


kind regards
Frank
  # 4  
03-09-2007, 05:11 AM

thanks for the reply.
i'm new to yuiext and couldn't understand the type of showGridContactAddress.
  # 5  
03-09-2007, 06:32 AM

i made what i want with this code..
var r=new Ext.data.Record({id:0,code_type:edt_code_type.el.dom.value,code:edt_code.el.dom.value});
codes_ds.add([r]);

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