当前位置:编程学习 > JAVA >>

ExtJs中从后台数据库中调用数据反馈到前台的问题

Ext.data.Store中


var urlStoreFields = new Array('iid', 'chaing_name', 'url', 'dcreatetime','sdesc'); var urlStore = createDataStore('urlStore', urlStoreFields, TABLE_PAGE_SIZE, URL_STORE_URL, false);


// 创建表格数据model
function createDataStore(id, field, psize, ajaxurl, autoload) {
var obj = Ext.create('Ext.data.Store', {
storeId: id,
fields: field,
pageSize: psize,
proxy: {
type: 'ajax',
url: ajaxurl,
method: 'POST',
reader: {
type: 'json',
root: 'root',
totalProperty: 'total'
},
listeners:{
exception:function(proxy, response, operation, eOpts ) {
if (response.responseText != '') {
var rst = jsonDecode(response.responseText);
errorsChoose('出错', rst.errors);
}
}
}
},
autoLoad: autoload
});
return obj;
}



/************************************华丽 的 分割线***********************/
以上所有表示的代表及时将从数据库中获取的列表值存入到dataStore中
现在在页面中编写一个在线编辑器Ext.form.HtmlEditor

var field = new Ext.form.HtmlEditor({
fieldLabel:'文书编辑器',
enableAlignments: true,
enableColors:true,
enableFont:true,
enableFontSize:true,
enableFormat:true,
enableLinks:true,
enableLists:true,
enableSourceEdit:true

});


/************************************华丽 的 分割线***********************/

现在想双击table中某一行 弹出一个在线编辑器 将数据库中的'sdesc'的值反馈到该模块中

// 双击表格
listeners: {
dblclick: {
element: 'body',
waitMsg: '请等待...',
fn: function () {

var id = getSelectedRowCell(urlTable, "iid"); // 获得选中行iid



// 加载详细信息表单数据
updateForm.getForm().load({
url: URL_GET_URL + id,
method: 'GET',
success: function (form, action) {
urlWindow.show();

/************问题所在 分割线 向下看**************/
setFormFieldValue(updateForm, 'field',urlStore.getAt(4).getValue(4));
urlStore.getAt(4).getValue(4) ;
/************问题所在 分割线 向上看**************/
},
failure: function (form, action) {
Ext.Msg.alert('出错', action.errors);
// errorsChoose('保存用户信息出错', action.result.errors);
}
});
}
}
}

在补充一下

// 设置表单指定字段的值
function setFormFieldValue(form, fieldname, value) {
form.getForm().findField(fieldname).setValue(value);
}



1、setFormFieldValue(updateForm, 'field',urlStore.getAt(4).getValue(4));
2、urlStore.getAt(4).getValue(4) ;
我就想问一下我哪句能获取到反馈数据库的值 Ext JS Ext.DataStore JavaScript
补充:Java ,  Java EE
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,