首頁  >  文章  >  web前端  >  ExtJs 實作動態載入grid完整範例_extjs

ExtJs 實作動態載入grid完整範例_extjs

WBOY
WBOY原創
2016-05-16 17:21:411193瀏覽
Ext3.3完整套件

Ext3.3中文文件

資料表的架構為:資料表table > 記錄record > 欄位

store的結構是: Ext.data.Store > Ext.data.Record>Ext.dataDataField

store 先驅動DataProxy 載入數據,DataProxy載入完成會驅動DataReader時行解析,最終獲得Record對象。

1.bean :
複製程式碼 程式碼如下:


程式碼如下:

.leo.bean;

public class Person {
private String name;
private int age;
private String sex;
private String birthday; Person(String name, int age, String sex, String birthday) {
super();
this.name = name;
this.age = age;
this.sex = sex;
this.birthday = birthday;
}

public String getName() {
return name;
}

public void setName(String name) { this.name = name;
}

public int getAge() {
return age;
}

public void setAge(int age) {
this.age = age;
}

public String getSex() {
return sex;
}

public void setSex(String sex) {
this .sex = sex;
}

public String getBirthday() {
return birthday;
}

public void setBirthday(String birthday) {this }

}

2.action

複製程式碼複製程式碼


複製程式碼



複製程式碼



複製碼
程式碼如下:


package com.leo.action;

import java.util.ArrayList;
import java.util.List; >import com.leo.bean.Person;
import com.opensymphony.xwork2.ActionSupport;

public class ExtjsAction extends ActionSupport {
private long results;Actions; >
public long getResults() {
return results;
}

public void setResults(long results) {
this.results = results;
public List getItems() {
return items;
}

public void setItems(List items) {
this.items = items;
}
}

public String execute() throws Exception {
this.results = 3;
Person p1 = new Person("張三", 29, "男", "1990-10-22");
Person p2 = new Person("李四", 28, "男", "1991-03-30");
Person p3 = new Person("王五", 27, "女", "1993- 08-17");
this.items = new ArrayList();
this.items.add(p1);
this.items.add(p2);
this. items.add(p3);
return SUCCESS; } } 3.struts-xml



複製程式碼


程式碼如下:



BR>"http://struts.apache.org/dtds/struts-2.1.dtd">




4.xml



複製程式碼


程式碼如下:


程式碼如下:






struts2
org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter


struts2
*.action 5.jsp 複製程式碼 程式碼如下:

<%@ page 언어="java" import="java.util.*" pageEncoding="UTF-8"%>


<머리>
ExtJs와 Struts2结합





<본문>



图示:
ExtJs 實作動態載入grid完整範例_extjs
陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn