Basic doubt about autocomplete? - Ext JS

本文讨论了如何在ExtJS网格中实现自动完成选择功能。作者遇到了在网格单元格内使用自动完成组件时的选择问题,并分享了解决方案,包括如何设置ComboBox以在选择自动完成项时更新网格中的值。

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

Hi I am testing autocomplete inside a grid, it appear ok inside a column but I don't know how select a row that appear in autocomplete and set this value to the column in the grid, any help please.

I am doing that:

acAddressType = new Ext.form.ComboBox({
store: ds,
displayField:'Description',
//valueField:'Description',
typeAhead: false,
loadingText: 'Searching...',
width: 570,
pageSize:5,
hideTrigger:true,
tpl: resultTpl,
allowBlank:false,
forceSelection: true,
selectOnFocus: true,
onSelect: function(record){ // override default onSelect to do redirect
currentAddressSelected.data["ContactAddressType_ExternalId"] = record.data.ExternalId;
currentAddressSelected.data["Description"] = record.data.Description;


}
});
Reply With Quote
  #2  
Old 03-13-2007, 05:30 PM
Default

Sorry I send the message for error before complete it.

I did it

Hi I am testing autocomplete inside a grid, it appear ok inside a column but I don't know how select a row that appear in autocomplete and set this value to the column in the grid, any help please.

I am doing that:

acAddressType = new Ext.form.ComboBox({
store: ds,
displayField:'Description',
//valueField:'Description',
typeAhead: false,
loadingText: 'Searching...',
width: 570,
pageSize:5,
hideTrigger:true,
tpl: resultTpl,
allowBlank:false,
forceSelection: true,
selectOnFocus: true,
onSelect: function(record){ // override default onSelect to do redirect
currentAddressSelected.data["ContactAddressType_ExternalId"] = record.data.ExternalId;
currentAddressSelected.data["Description"] = record.data.Description;

}
});

the column in grid
.......
cm = new Ext.grid.ColumnModel([

{header: "Address1", dataIndex: 'Address1', width: 120, sortable: true, locked: true,
editor: new Ed(new fm.TextField({allowBlank: false}))
},
{header: "AddressType", dataIndex: 'ContactAddressType.Description', width: 220, sortable: true,
editor: new Ed(acAddressType)
},


kind regards
Frank
Reply With Quote
  #3  
Old 03-13-2007, 05:47 PM
Default

I don't know if is right it but now I can select an item from autocomplete and it appear in the column in the grid, I did it

onSelect: function(record){ // override default onSelect to do redirect
//debugger;
currentAddressSelected.data["ContactAddressType_ExternalId"] = record.data.ExternalId;
// currentAddressSelected.data["Description"] = record.data.Description;
acAddressType.setValue(record.data[acAddressType.displayField]);
acAddressType.collapse();

}

the other trouble now is when I add a new record in the column where is the autocomplete appear it

<DIV class="x-grid-col-1 x-grid-cell-inner"><DIV class=x-grid-cell-text unselectable="on"></DIV></DIV>


is something wrong?

kind regards
Frank
Reply With Quote
  #4  
Old 03-13-2007, 08:25 PM
Default

Do you have a page that i can goto to see it. It would really help to see all your code to figure out what might be causing this problem.

Jon
__________________
Jon
Web Application Developer - Indianapolis Motor Speedway
bombdiggity.net
Reply With Quote
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值