熱點推薦:
您现在的位置: 電腦知識網 >> 編程 >> Java編程 >> JSP教程 >> 正文

gridpanel動態加載數據的實例代碼

2022-06-13   來源: JSP教程 
這篇文章介紹了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());
}


From:http://tw.wingwit.com/Article/program/Java/JSP/201311/20324.html
    推薦文章
    Copyright © 2005-2022 電腦知識網 Computer Knowledge   All rights reserved.