dn2965
4 Apr 2007, 11:59 PM
help me ,how to set the grid_toolbar on the grid's upside、top
http://i127.photobucket.com/albums/p138/dn2965/other/TOP1-1.jpg
move to top
http://i127.photobucket.com/albums/p138/dn2965/other/TOP2.jpg
thanks
JeffHowden
5 Apr 2007, 12:28 AM
Using the paging grid in the examples as a test-case, I think it's safe to assume that:
var gridFoot = grid.getView().getFooterPanel(true);
// add a paging toolbar to the grid's footer
var paging = new Ext.PagingToolbar(gridFoot, ds, {
...
});
could be changed up slightly to be:
var gridHead = grid.getView().getHeaderPanel(true);
// add a paging toolbar to the grid's footer
var paging = new Ext.PagingToolbar(gridHead, ds, {
...
});
Saving my changes and running them in the browser confirms that that's as simple as it gets.
dn2965
5 Apr 2007, 3:39 AM
flowing is my code, could you see it , and how to ...do
my ext version is 0.33
thanks
/*
* yui-ext
* Copyright(c) 2006, Jack Slocum.
*/
var bro_dataModel;
var bro_colModel;
var bro_grid;
var curDic;
var Xml_bro = {
init :
function(){
function info(val){
return val ;
}
var bro_schema = {
tagName: 'Item',//所目標的tag
id: 'bro_schema_id',
totalTag: 'deal', //它告訴model去尋找該節點下全部的紀錄
fields: ['no','name','ref','hits','id']
};
// the DefaultColumnModel expects this blob to define columns. It can be extended to provide
// custom or reusable ColumnModels
var bro_colModel = new YAHOO.ext.grid.DefaultColumnModel([
{header: "no.", width: 30},
{header: "辭條", width: 145, sortable: true,renderer:info},
{header: "出處", width: 80},
{header: "出現次數", width: 50, sortable: true},
{header: "id", width: 50}
]);
bro_colModel.setHidden(2,true);//
bro_colModel.setHidden(3,true);//
bro_dataModel = new YAHOO.ext.grid.XMLDataModel(bro_schema);
bro_dataModel.initPaging('ini.jsp',20);
//bro_dataModel.baseParams = {'bro_tb':bro_tb,'test':test0405()}; //加入自己的參數
function test0405(){
return 'aaa' ;
}
// create the Grid
bro_grid = new YAHOO.ext.grid.Grid('bro-grid', bro_dataModel, bro_colModel
);
bro_grid.autoWidth = true;
bro_grid.autoHeight = true;
bro_grid.render();
//以首頁算起 //0315 設定為不載入 linux 的./很重要
// bro_dataModel.load('./sheldon.xml');
//當某一列被點擊
bro_grid.on("rowclick",send);
function send(g,r,e){
getRowFirstCol(g,r)
}
//rowclick : (Grid this, Number rowIndex, YAHOO.ext.EventObject e)
function getRowFirstCol(g,r){
var mydm=g.getDataModel();
var area=new Array();
area[0]=r //[0][0];
var dic_ref=mydm.getRows(area)[0][2];//[0]
var Item_Id=mydm.getRows(area)[0][4];//
//直接送dwr --> 顯示 不用再回到index.htm
//alert(dic_ref);
//alert(Item_Id);
DicManager.returnSense(dic_ref,Item_Id,displayEntry);
}
//*******************toolbar is here
var toolbar = bro_grid.getView().getPageToolbar();
toolbar.addSeparator();
toolbar.addButton({
className: 'new-topic-button',
text: "New Topic",
// click: createTopic
}
);
//*****************************************************
bro_dataModel.loadPage(1);
}
}
YAHOO.ext.EventManager.onDocumentReady(Xml_bro.init,Xml_bro, true);
Animal
5 Apr 2007, 11:54 PM
Can't be done with 0.33 without customizing the GridView - are you up to that?
Or you could upgrade, it's not that difficult.
Powered by vBulletin® Version 4.1.5 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.