Adding a record when xml is empty? - Ext JS

本文探讨了在ExtJS框架中如何解决向初始为空的表格添加记录的问题,并提供了一个使用ExtJS alpha3 rev2版本成功实现的例子。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

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
Reply With Quote
  #2  
Old 03-08-2007, 12:59 PM
Default

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

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
Reply With Quote
  #4  
Old 03-09-2007, 05:11 AM
Default

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

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]);
Reply With Quote
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值