extjs中的combobox有个自动完成功能,就是在你输入部分字符后,可以自动补充称完整的已存在项。
如下图:
在输入ch的时候,会弹出所有ch开头的项
配置方法:
关键是几个属性:
typeAhead:true
mode:’local’
如果是远程数据集的话,最好是先把store load了。
今天从一个文件中拷贝了一个formpanel的配置,用以下代码提交
fp.getForm().submit({
url: GURLBase + "/EXEC/" + GTrackID + "/" + GAppID+"?op=addMenuItem&page=menuitem&SessionId="+GMySession,
method: ‘POST’,
scope: this,
params: {
},
success: function(form, action) {
win.close();
store.reload();},
failure: function(form, action) {
if (!fp.getForm().isValid()) {
return;
}
Ext.Msg.alert(‘系统提示’, ‘<br/> 操作失败,请重新操作’);
}}); //end submit
提交后,发现,firebug竟然没有post的过程数据,在intraweb的断点中,发现request的contentfields数据竟然是这样的:
—————————–145415869681
Content-Disposition: form-data; name="id"
67
—————————–145415869681
Content-Disposition: form-data; name="cname"
查看注册清单
—————————–145415869681
Content-Disposition: form-data; name="ename"
view report
—————————–145415869681
Content-Disposition: form-data; name="parentid"
0
—————————–145415869681
Content-Disposition: form-data; name="leaf"
1
—————————–145415869681
Content-Disposition: form-data; name="page"
rep_list
—————————–145415869681
Content-Disposition: form-data; name="icon"
bg_waitIcon
—————————–145415869681
Content-Disposition: form-data; name="module"
report
—————————–145415869681
Content-Disposition: form-data; name="permcode"
024
—————————–145415869681–
原因:
经过仔细查看,原来formpanel竟然配置了
fileUpload:true
看来,拷贝来的代码,还是应该好好的检查的,浪费了我一天的时间啊~~~
如下,一个panel,如何动态更新其中的html的值,其实就是要更改frame里面的url
var p = new Ext.Panel({
title: ‘My Panel’,
collapsible:true,
width:400,
id:’panel1’,
html:'<iframe scrolling="auto" frameborder="0" width="100%" height="100%" src="PagingGrid.jsp"></iframe>’
});
方法:
Ext.getCmp(‘panel1’).body.update(‘<iframe scrolling="auto" frameborder="0" width="100%" height="100%" src="PagingGrid11.jsp"></iframe>’);
To enable autocomplete for edit/combobox
Starting from IE 5.5 Microsoft added a very cool feature to any editboxes/comboboxes – you may start to enter some value and automatically will be suggested a value from "list" (previous typed)
As you understand now I’ll describe how to add such possibility to any editbox from your application:-)
1. you must declare a few const values:
const
SHACF_AUTOSUGGEST_FORCE_ON = $10000000;
SHACF_AUTOSUGGEST_FORCE_OFF = $20000000;
SHACF_AUTOAPPEND_FORCE_ON = $40000000;
SHACF_AUTOAPPEND_FORCE_OFF = $80000000;
SHACF_DEFAULT = $0;
SHACF_FILESYSTEM = $1;
SHACF_URLHISTORY = $2;
SHACF_URLMRU = $4;
2. you must declare a SHAutoComplete function from Shlwapi.dll library:
function SHAutoComplete(hwndEdit: HWnd; dwFlags: DWORD): HResult; stdcall; external ‘Shlwapi.dll’;