数据库

位置:IT落伍者 >> 数据库 >> 浏览文章

gridpanel动态加载数据的实例代码


发布日期:2023年07月08日
 
gridpanel动态加载数据的实例代码
这篇文章介绍了gridpanel动态加载数据的实例代码有需要的朋友可以参考一下复制代码 代码如下:


<script type=text/javascript>
function editEsOrder(optionssuccessresponse){
if (success){
var tagModelManager_maxOrderIdJson=ExtutilJSONdecode(responseresponseText);
var orderValue = tagModelManager_maxOrderIdJsonmaxOrderId ;
ExtgetCmp(esorder)setValue(orderValue) ;
}
}
var tagModelManager_toolBar=new ExtToolbar({
items:[
{id:tagModel_Savetext:添加iconCls:addhandler:tagModel_Save}

{id:tagModel_dropSelectedtext:删除iconCls:removehandler:tagModel_dropSelected}
]});
new ExtgridGridPanel({
id:tagModelManager_tagModelGrid
autoScroll:true store:new ExtdataStore()
cm:new ExtgridColumnModel([new ExtgridRowNumberer()])
sm:new ExtgridCheckboxSelectionModel()
renderTo:tagModelManager_tagModelDiv
width:ExtgetCmp(TagModel_win)getSize()width
height:ExtgetCmp(TagModel_win)getSize()height
hideHeaders :false
loadMask:{msg:正在加载数据请稍候}
collapsible : true
collapsed : false
bbar:new ExtPagingToolbar({
id:tagModelManager_tagModelPagingBar
pageSize:getComboValue()
store:new ExtdataStore()
displayInfo:true
})
tbar:tagModelManager_toolBar
});
ExtgetCmp(tagModelManager_tagModelGrid)render() ;
ExtgetCmp(tagModelManager_tagModelGrid)on(rowdblclick tagModelSelectRowDblClickEvent);
function tagModelSelectRowDblClickEvent(selectionModel rowIndex selectedRecord) {
var selectedRows = ExtgetCmp(tagModelManager_tagModelGrid)getSelectionModel()getSelections();
var row=selectedRows[];
tagModel_SaveOrEdit(editrow);
}
function tagModel_Save() {
tagModel_SaveOrEdit(save);
}
function tagModelList_search() {
ExtAjaxrequest({
url:editTagModelhtml?method=getParams
callback:getSearchList
});
}
function getSearchList(optionssuccessresponse) {
if (success){
var tagModelManager_json=ExtutilJSONdecode(responseresponseText);
tagModelManager_tagModelGridTitle = tagModelManager_jsontagModelManager_tagModelGridTitle;
var record = tagModelManager_jsonrecord ;
var tagModelManager_tagModelColumnModels = tagModelManager_jsontagModelManager_tagModelColumnModels ;
  var tagModelManager_tagModelColumnModel=new  ExtgridColumnModel(ExtutilJSONdecode("["+"new  ExtgridRowNumberer()"+""+"new  ExtgridCheckboxSelectionModel()"+""+tagModelManager_tagModelColumnModels+"]"));
tagModelManager_tagModelColumnModeldefaultSortable=true;
var strucutreModelManager_tagModelDataStore = new ExtdataStore({
baseParams: { tagModelKeyword : ExtgetCmp(tagModelManager_search_button)eldomvaluetrim() }
proxy:new ExtdataHttpProxy({
url:editTagModelhtml?method=getTagModelDataList
})
reader:new ExtdataJsonReader({
totalProperty:resultSizeroot:tagModelList}ExtutilJSONdecode(record)) });
ExtgetCmp(tagModelManager_tagModelPagingBar)bind(strucutreModelManager_tagModelDataStore);
strucutreModelManager_tagModelDataStoreload({params:{start:limit:getComboValue()}}) ;
ExtgetCmp(tagModelManager_tagModelGrid)setTitle(tagModelManager_tagModelGridTitle) ;
ExtgetCmp(tagModelManager_tagModelGrid)reconfigure(strucutreModelManager_tagModelDataStoretagModelManager_tagModelColumnModel);
ExtgetCmp(tagModelManager_tagModelGrid)expand(false) ;
}
}
function tagModelList_all(){
ExtAjaxrequest({
url:editTagModelhtml?method=getParams
callback:getTagModel
});
}
function getTagModel(optionssuccessresponse){
if (success){
var tagModelManager_json=ExtutilJSONdecode(responseresponseText);
tagModelManager_tagModelGridTitle = tagModelManager_jsontagModelManager_tagModelGridTitle;
var record = tagModelManager_jsonrecord ;
var tagModelManager_tagModelColumnModels = tagModelManager_jsontagModelManager_tagModelColumnModels ;
  var tagModelManager_tagModelColumnModel=new  ExtgridColumnModel(ExtutilJSONdecode("["+"new  ExtgridRowNumberer()"+""+"new  ExtgridCheckboxSelectionModel()"+""+tagModelManager_tagModelColumnModels+"]"));
tagModelManager_tagModelColumnModeldefaultSortable=true;
var strucutreModelManager_tagModelDataStore = new ExtdataStore({
proxy:new ExtdataHttpProxy({
url:editTagModelhtml?method=getTagModelDataList
})
reader:new ExtdataJsonReader({
totalProperty:resultSizeroot:tagModelList}ExtutilJSONdecode(record)) });
ExtgetCmp(tagModelManager_tagModelPagingBar)bind(strucutreModelManager_tagModelDataStore);
strucutreModelManager_tagModelDataStoreload({params:{start:limit:getComboValue()}}) ;
ExtgetCmp(tagModelManager_tagModelGrid)reconfigure(strucutreModelManager_tagModelDataStoretagModelManager_tagModelColumnModel);
ExtgetCmp(tagModelManager_tagModelGrid)expand(false) ;
}
}
ExtAjaxrequest({
url:editTagModelhtml?method=getParams
callback:getTagModel
});
</script>
  public void getTagModelDataList(ActionMapping mapping ActionForm  actionformHttpServletRequest request HttpServletResponse response){
ITagModelManager tagmgr = thisgetPkgServer()getDriver()getOperateServer()getTagModelManager() ;
List<HashMap<StringString>> models = new ArrayList<HashMap<StringString>>();
String tagModelKeyword = requestgetParameter("tagModelKeyword");
List<EssTagModel> tagModels ;
tagModels = tagmgrgetEssTagModels() ;
int resultSize = ;
if (null != tagModels && !tagModelsisEmpty()){
//数据分页显示
resultSize = tagModelssize() ;
String start = requestgetParameter("start") ;
String perPage = requestgetParameter("limit") ;
String esType ="";
if (null != start && null != perPage){
int fromIdx = IntegerparseInt(start);
int per = IntegerparseInt(perPage);
int toIdx = fromIdx + per ;
if (toIdx > resultSize) toIdx = resultSize ;
tagModels = tagModelssubList(fromIdxtoIdx) ;
}
for(EssTagModel etm : tagModels){
HashMap<StringString> map = new HashMap<String String>();
mapput("id" LongtoString(etmgetId())) ;
mapput("esidentifier" etmgetEsidentifier()) ;
mapput("estype" etmgetEstype()) ;
mapput("esdescription" etmgetEsdescription()) ;
mapput("esorder" LongtoString(etmgetEsorder())) ;
mapput("metadata" etmgetMetadata()) ;
modelsadd(map) ;
}
}
JSONObject json = new JSONObject();
JSONArray ary = new JSONArray(models);
jsonput("tagModelList" ary);
jsonput("resultSize"resultSize);
writeJson(response jsontoString()) ;
}
public void getParams(ActionMapping mapping ActionForm actionformHttpServletRequest request HttpServletResponse response){
LinkedHashMap<StringString> tags = new LinkedHashMap<StringString>() ;
tagsput("id" "id") ;
tagsput("esidentifier" "字段") ;
tagsput("estype" "类型") ;
tagsput("esdescription" "描述") ;
tagsput("esorder" "顺序") ;
tagsput("metadata" "元数据") ;
tagsput("esisnull" "是否为必填项") ;
tagsput("eslength" "字段长度") ;
tagsput("esdotlength" "小数点位数") ;
tagsput("esissystem" "是否为系统字段") ;
JSONObject json = new JSONObject();
jsonput("record" getJsonRecord(tags)) ;
jsonput("tagModelManager_tagModelColumnModels" getJsonColumnModel(tags)) ;
writeJson(responsejsontoString());
}

               

上一篇:Java怎样连接Access数据库

下一篇:JSP操作Access数据库