導航:首頁 > 編程語言 > extjspost參數

extjspost參數

發布時間:2023-08-08 09:19:34

⑴ Extjs打開一個window的url參數問題

沒用過extjs,不過我用的jQuery的dialog插件也會遇到類似的問題,我的解決方法是專這樣的:

目標頁面的html必然寫在一屬個div中,例如
<div dialog_title="title" style="width: 400px; height: 200px;">
content here...
</div>

先通過ajax載入目標,然後再打開窗口,這樣title, width, height直接用目標的設定值就行了

只是一個思路,希望對你有幫助

⑵ ExtJs ComboBox的render事件可以有參數嗎都有什麼參數

extjs api如下:

render : ( Ext.Component this )
在組件被渲染之後觸發。
在組件被 rendered(渲染) 之後觸發。
監聽器將以如下的參數內格式被調用:
this : Ext.Component

參數只有它本身,容如果你不想這么用,你可以用combox對象中的on方法,自己寫實現function就行,api如下:

on( String eventName, Function handler, [Object scope], [Object options] ) : void
給對象添加事件處理器 (addListener的簡寫形式)
給對象添加事件處理器 (addListener的簡寫形式。)
參數:
eventName : String
監聽的事件類型
handler : Function
事件調用的方法
scope : Object
(可選)處理方法執行時的作用域 (this 的引用)。 如果被忽略。默認為觸發事件的對象。
options : Object
可選 包含處理器配置的對象。
返回值:void

⑶ extjs怎麼獲取後台的數據或者是變數。。。求大神速回

1. 使用form表單提交
使用表單提交是調用了表單的submit方法,其配置項包括url、method等。這種方式能夠以JSON的形式提交參數信息。

var myform = Ext.create('Ext.form.Panel',{undefined

defaultType: 'textfield',

items:[{undefined

fieldLabel : 'Name',

name : 'name'

},{undefined

fieldLabel: 'Gender',
name : 'gender'
},{undefined
fieldLabel : 'Age',
name: 'age'

}],

buttons: [{undefined

text : 'load',

handler : function(){undefined

this.up('form').getForm().submit({undefined

url: '/request/userinfo',

method : 'POST',

success : function(form, action){undefined

console.log(form);

Ext.Msg.alert('title', 'load success');

});

}]);

2. 使用Ajax非同步提交

將上述handler方法中的內容換成一下代碼即可。在Ajax的request方法中是一個配置對象,其配置參數包括url,type,params。其中params表示要提交的參數,在此例中是從form表單中通過getValues()方法獲得的。該種方式也能將參數一JSON的方式提交到後台,與一個對象匹配。

var values = this.up('form').getForm().getValues();

Ext.Ajax.request({undefined

url:'/request/userinfo',

headers : {undefined'userHeader': 'userMsg'},

type:'POST',

params:values,

success:function(response){undefined

var data = response.responseText;

console.log(data);

console.log("success");

},

});

3. 使用Ext.data.Store

在項目中經常需要通過提交一些數據來從後台獲取相應的信息。例如,在表單中輸入某個人的id和name就可以查出它的相關信息並在前台顯示。一個關於extjs的例子如下:

//data Model

Ext.define('User',{undefined

extend: 'Ext.data.Model',

fields: [{name:'name',type:'string'},

{name:'gender',type:'string'},

{name:'age',type:'string'}

]

});

var userStore = Ext.create('Ext.data.Store',{undefined

model: 'User',

pageSize: 20,

// autoLoad : true,

proxy: {undefined

type : 'ajax', //提交數據的方式

url : '/request/userinfo',

reader : { //以json的形式讀取將要提交的數據

type : 'json',

root : 'resultList'

},

writer : {undefined

type : 'json'

},

actionMethods : {undefined

create : 'POST'

}

},

});

//grid Panel

Ext.create('Ext.grid.Panel',{undefined

store: userStore,

columns: [

{header : 'Name', dataIndex : 'name'},

{header : 'Gender', dataIndex : 'gender'},

{header : 'Age', dataIndex : 'age'}

],

height: 200,

width: 400,

renderTo: 'div2'

});

//form Panel

var myform = Ext.create('Ext.form.Panel',{undefined

defaultType: 'textfield',

items:[{undefined

fieldLabel: 'Name',

name: 'name'

},{undefined

fieldLabel: 'Gender',

name: 'gender'

},{undefined

fieldLabel : 'Age',

name : 'age'

}],

buttons: [{undefined

text: 'load',

handler: function(){undefined

var values = this.up('form').getForm().getValues();

console.log(values);

userStore.proxy.extraParams=values;

userStore.loadPage(1);

}

}

});

在handler方法中獲取form表單的參數後,賦值給userStore.proxy.extraParams,然後調用userStore.loadPage(1)。調用loadPage()方法時,會委託給proxy對象去後台獲取數據。所以對proxy的配置是核心。使用這個方式從後台獲取數據時,後台介面返回的對象應該包括一個List欄位,list中包含所需要的具體信息。比如
@ReponseBody

public UserInfoResp getUserInfo(User user) {undefined

}

UserInfoResp應該像這樣有一個List欄位

class UserInfoResp {undefined

List<User> resulltList;

}

⑷ 我寫了一個extjs ajax的form提交。不知道ajax里的參數怎麼寫,請大家幫忙

Ext.Ajax.request({
url: url,
method: 'post',
params: {
protocolIds: protocolIdArr
},
success: function(response) {
if(Ext.decode(response.responseText).success) {
//正常返回

} else {
//邏輯錯誤

}

},
failure: function(response) {
//錯誤信息

}
});
}

⑸ extjs使用window.open(url)方法打開新窗口,怎麼使用POST方式傳參

使用window.opener.document可在打開頁面直接訪問父窗口變數和方法,直接取即可。

閱讀全文

與extjspost參數相關的資料

熱點內容
怎麼查一個網站的外鏈 瀏覽:675
linux下db2安裝時版本選擇 瀏覽:738
匯編編程用哪個軟體 瀏覽:486
仙樂下的歌在文件管理哪裡 瀏覽:477
115網盤解析工具2014 瀏覽:371
內圓弧銑刀怎麼編程 瀏覽:410
記事本文件轉word格式對齊 瀏覽:300
excel刪除恢復文件 瀏覽:290
三星s4怎麼切換3g網路 瀏覽:994
什麼是網站維護 瀏覽:314
文件夾錄像在哪裡 瀏覽:621
可以發語音的是什麼app 瀏覽:804
恢復手機桌面文件管理 瀏覽:627
用什麼軟體可以打開psd文件 瀏覽:459
公安有哪些警務app 瀏覽:150
生意轉租用什麼app 瀏覽:683
廣義的網路信息保密性是指 瀏覽:657
qq背景唯美簡約圖片 瀏覽:292
sky網路電話怎麼收費 瀏覽:599
編程公司哪個比較好 瀏覽:182

友情鏈接