ext_GridPanel2_3

2793 단어 gridPanel
	//Proxy
	var proxy = new Ext.data.MemoryProxy(data);
	
	//Record  
	var Human = Ext.data.Record.create([
	   {name: "Name", type: "string", mapping: "name"},
	   {name: "Sex", type: "string", mapping: "sex"},
	   {name: "Birthday", type: "string", mapping: "birthday"},
	   {name: "Education", type: "string", mapping: "edu"},
	   {name: "Memo", type: "string", mapping: "memo"}
	]);
	
	//Reader
	var reader = new Ext.data.JsonReader({}, Human);
	
	//store
	var store = new Ext.data.Store({
		proxy: proxy,
		reader: reader
	});
	store.load();
	
	
	
	var grid = new Ext.grid.GridPanel({
		title: " ",
		width: 700,
		autoHeight: true,
		cm: cm,
		store: store,
		renderTo: "a",
		frame: true,
		autoExpandColumn: "memo",
		buttonAlign: "center",
		buttons: [
		 {
			 text: " ",
			 handler: function(){
				 var rsm = grid.getSelectionModel(); // 
				 rsm.selectFirstRow();
			 }
		 },
		 {
			 text: " ",
			 handler: function(){
				 var rsm = grid.getSelectionModel();
				 if(!rsm.hasPrevious()){
					 Ext.Msg.alert(" "," ");
				 } else {
					 rsm.selectPrevious();
				 }
			 }
		 },
		 {
			 text: " ",
			 handler: function(){
				 var rsm = grid.getSelectionModel();
				 if(!rsm.hasNext()){
					 Ext.Msg.alert(" ","  ");
				 } else {
					 rsm.selectNext();
				 }
			 }
		 },
		 {
			 text: " ",
			 handler: function(){
				 var rsm = grid.getSelectionModel();
				 rsm.selectLastRow();
			 }
		 },
		 {
			 text: " ",
			 handler: function(){
				 var rsm = grid.getSelectionModel();
				 rsm.selectAll();
			 }
		 },
		 {
			 text: " ",
			 handler: function(){
				 var rsm = grid.getSelectionModel();
				 rsm.deselectRange(0,grid.getView().getRows().length - 1);
			 }
		 },
		 {
			 text: " ",
			 handler: function(){
				 var rsm = grid.getSelectionModel();
				 for(var i = grid.getView().getRows().length - 1; i >=0; i--){
					 if(rsm.isSelected(i)){
						 rsm.deselectRow(i);
					 } else {
						 rsm.selectRow(i,true); // , 
					 }
				 }
			 }
		 }
		 
		]
	});
});
*/

좋은 웹페이지 즐겨찾기