導航:首頁 > 編程語言 > 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參數相關的資料

熱點內容
cad文件為什麼顯示文件名是否正確 瀏覽:174
程序配置文件能自動轉換成txt 瀏覽:985
r4燒錄卡不同版本 瀏覽:962
怎麼升級qq群為2000 瀏覽:347
微信己冊除的文件怎樣找回來 瀏覽:715
蘋果美國賬號共享2017 瀏覽:252
ps文件修改後打開還是原圖 瀏覽:220
燒卡機蘋果4微信qq哪裡下載 瀏覽:780
ug120找不到指定文件 瀏覽:522
cda文件怎麼轉換成mp3格式 瀏覽:702
青島hpv疫苗在哪個app預約 瀏覽:881
雙十一成交額2021數據在哪裡看 瀏覽:631
蘋果手機怎麼打開移動數據 瀏覽:637
文件掃描成圖片是彩色的嗎 瀏覽:50
編程里的comply什麼意思 瀏覽:91
電腦上面點了禁用網路怎麼改回來 瀏覽:28
javacatch執行 瀏覽:182
ps軟體文件名字 瀏覽:184
黑蘋果查找文件路徑 瀏覽:397
現在編程都有哪些語言 瀏覽:360

友情鏈接