PDA

View Full Version : Adding a record when xml is empty?



franklt69
27 Feb 2007, 6:44 PM
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

hicker
8 Mar 2007, 10:59 AM
hi frank, did you find a solution for this problem?

franklt69
8 Mar 2007, 3: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

hicker
9 Mar 2007, 3:11 AM
thanks for the reply.
i'm new to yuiext and couldn't understand the type of showGridContactAddress.

hicker
9 Mar 2007, 4: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]);