導航:首頁 > 編程語言 > extjsdecode

extjsdecode

發布時間:2023-05-13 12:12:05

1. extjs 控制項中拿取通過ajax傳過來的json數據問題

checkBoxPanel 中增加事件監聽,在處理函數是用ajax調用後台action,
Ext.Ajax.request({
//code...,
success:function(response){
var data = Ext.decode(response.responseText);//這樣能取到值,如果是list的話傳過版來轉化後應該是數組了。權裡面再是對象。最後再給checkBoxPanel賦值
}
});

2. 大師傅是否經常會遇到下面Extjs頁面請求後台數據的時候,頁面超時的情況,該如何解決

每個Ext.Ajax.request都有個屬性
timeout : Number
The timeout in milliseconds to be used for this request. Defaults to 30 seconds.
普通的請求使用超時屬性是這樣
Ext.Ajax.request({
url: 'ajax_demo/sample.json',
success: function(response, opts) {
var obj = Ext.decode(response.responseText);
console.dir(obj);
},
failure: function(response, opts) {
console.log('server-side failure with status code ' + response.status);
},
timeout:3000000
});

store的請求則是這樣
var myStore = Ext.create('Ext.data.Store', {
model: 'User',
proxy: {
type: 'ajax',
url: '/users.json',
reader: {
type: 'json',
root: 'users'
},
timeout:3000000

},
autoLoad: true
});

3. 關於Extjs的EditGrid問題

樓上的兄弟說的也可行,那是一個個數據單獨提交的方法,這種方法比較耗程序性能,假如數據量不大可以用這種
,另外也可以批量提交修改: 1,先用 grid.getStore();取正慶到 store , 2 用for循環把修燃陸改過的store里的記錄取到,放入一個數組里var items[] , 3 把 items 數據用 Ext.decode(items); 轉成json string數據, 把此數據作為參數傳到 action 中, 4 在action中 用 Example[] examples = gson.fromJson(itemParams, Example[].class); 方法把 json 數據轉成對象, 這里 Example 是要操作的舉段握對象, gson是 com.google.gson.Gson , 轉成對象就可以對修改的對象進行保存操作了

4. extjs 怎樣從資料庫或後台中獲取值給form填充默認值

form 中的元素用數組,然後用後台傳來的 json 給 元素 setValue()

vararr1=newArray();
arr1['沖啟id']=new=newExt.form.TextField({name:'id',fieldLabel:'id',value:0});
arr1['name']=newExt.form.TextField({name:'name',fieldLabel:'姓名Name',value:""});
arr1['email']=newExt.form.TextField({name:'email',fieldLabel:'電郵地址Email',value:""});
varformset=newExt.FormPanel({
frame:true,
trackResetOnLoad:false,
defaults:{labelAlign:'right',labelWidth:60,數檔frame:true,layout:'form'},
fields_arr:arr1 ,
items:[this.fields_arr['id'],
this.fields_arr['name'],
this.fields_arr['email']
],
refrefield:function(config){
for(varkeyinconfig){
if(this.fields_arr[key]!==undefined){
this.fields_arr[key].setValue(config[key]);
}
}
},
});

Ext.Ajax.request({
url:'user_save.action',
method:'post',
success:function(response,options){
varo=Ext.util.JSON.decode(response.responseText);
formset.refrefield(0);//這里給欄位賦值
薯判亂},
failure:function(){
}
});
}

5. Extjs Ajax非同步請求時亂碼如何解決

url=encodeURI(encodeURI(url));前台轉碼一次,攔侍告java.net.URLDecoder.decode(paperTitle,"談春UTF-8");後簡明台也轉碼下,試試。

6. Extjs項目中接收json數據點擊某個下拉框實現回顯數據

使用回調函數對 年假欄位賦值.

varholidayType=newExt.form.ComboBox({
store:newExt.data.SimpleStore({ fields:['value','text'],
data:[['0','事假'],['1','病假'],['2','年假']] }),
fieldLabel:'性別',
displayField:'text',
valueField:'value',
triggerAction:'all',
allowBlank:false,
width:86,
editable:false,
mode:'local',
listeners:{
select:function(){
varcomb=this;
if(this.getValue()=="年假"){
Ext.Ajax.request({
url:url,
method:'POST',async:false,scope:this,
params:params,
success:function(response,options){
//alert(response.responseText);
varrsInfo=Ext.util.JSON.decode(response.responseText);
varhaveDays=comb.ownerCt.getComponent('havDays')
//注意這里的引用方式
if(rsInfo.success){
haveDays.setValue(rsInfo.data);
}else{

}
}),
}
},
},
}
});

varhavDays=newExt.form.NumberField({name:'havDays',itemId:'havDays',
fieldLabel:'年假剩餘天數',
value:0,});

7. extjs 4.1 怎麼不能使用 Ext.util.JSON.decode

Ext.JSON.decode就可以了,只是去掉了util

8. extjs有沒有把字元串轉換成json數據的方法

有的,extjs 可以野困使用 Ext.util.JSON.decode(字頌源念符裂者串) 的方式,將符合JSON規則的字元串,轉換為 json對象。
Ext.util.JSON.decode 可以使用縮寫 Ext.decode 代替,更為簡潔。

9. Extjs之兩個JS頁面直接的對象傳遞問題

同一頁面的JS上下文是相同作用域的,

你的應該是不同頁面間傳值、所以借內用了cookies;

//接收頁面:
varrecord=Ext.util.Cookies.get("valueJson");
//然後容拿個record列名自己看看
varobj=Ext.decode(record);
alert(obj.colName);

10. ExtJs裡面如何解析本地Json字元串

使用Ext.JSON.decode(jsonStr)可以將json字元串轉化成對象,然後將對象賦給store的內data屬性即可,簡單例子容
Ext.create('Ext.data.Store', {
fields: [
{name: 'roomtype', type: 'string'}
],
data : Ext.JSON.decode('{"root": [{"roomtype":"00"},{"roomtype":"11"}]}').root
});

閱讀全文

與extjsdecode相關的資料

熱點內容
怎麼他么怎麼又網路了 瀏覽:649
java會出現內存泄露么 瀏覽:617
蘋果4s鎖屏後怎麼還顯示歌曲 瀏覽:207
鴻蒙系統文件管理哪些可以刪除 瀏覽:550
ubuntuqt創建工程沒有配置文件 瀏覽:126
網站登錄變成其他網站怎麼處理 瀏覽:202
ug數控編程學校有哪些 瀏覽:203
java圖片上傳顯示 瀏覽:402
ppt的文件名後綴 瀏覽:902
ug編程軟體下載到哪個盤 瀏覽:359
炫酷字體APP下載的文件在哪裡 瀏覽:668
廊坊哪裡有少兒編程機構 瀏覽:312
cad新文件能找回來嗎 瀏覽:951
導出手機qq文件到u盤 瀏覽:456
電腦如何打開ppt文件怎麼打開方式 瀏覽:782
魅族鎖定區文件夾 瀏覽:357
刻字cnc怎麼編程 瀏覽:182
學校的網路拓撲結構圖 瀏覽:784
收集100個pdf文件里關鍵詞 瀏覽:594
蘋果關閉4g網路設置 瀏覽:289

友情鏈接