Extjs4 Treegrid 使用心得分享(經(jīng)驗(yàn)篇)_PHP教程
推薦:關(guān)于php循環(huán)跳出的問(wèn)題本篇文章是對(duì)php中循環(huán)跳出的問(wèn)題進(jìn)行了詳細(xì)的分析介紹,需要的朋友參考下 復(fù)制代碼 代碼如下: //php當(dāng)前循環(huán)為1,循環(huán)由里到外依次遞增,break默認(rèn)為1,例如跳出第2層循環(huán) for ($i=0;$i3;$i++){ foreach (array(1,2,3) as $val){ foreach (array(1,2,3) as $val){ echo
最近調(diào)試EXTJS 4的treegrid實(shí)例,看了很多水友的文章,以及官方的demo, 沒(méi)一個(gè)可靠的,全都無(wú)法顯示出來(lái)。像對(duì)于我們習(xí)慣用C++的coder來(lái)說(shuō),EXTJS簡(jiǎn)直就是一群無(wú)政府土匪來(lái)維護(hù)的,官網(wǎng)上連個(gè)搜索框都沒(méi)有,找資料基本靠遍歷,還是人工的。
使用treegrid,需要在調(diào)用頁(yè)面的head中加載以下幾個(gè)文件:
<link rel="stylesheet" type="text/css" href="css/ext-all.css">
<script type="text/javascript" src="ext-all.js"></script>
<script type="text/javascript" src="treegrid.js"></script>
然后在頁(yè)面的body中寫(xiě)上一個(gè)div
<div id="tree-example"></div>
以上官方就這么寫(xiě)的,BUT,蛋疼的是,JS里沒(méi)有改,不改就沒(méi)法運(yùn)行成功。把treegrid.js中的renderto,改成我們的div的ID就行了。
記得把json數(shù)據(jù)文件和css文件等拷貝到調(diào)用目錄下。
完成的treegrid.js代碼為:
/*
This file is part of Ext JS 4
Copyright (c) 2011 Sencha Inc
Contact: http://www.sencha.com/contact
GNU General Public License Usage
This file may be used under the terms of the GNU General Public License version 3.0 as published by the Free Software Foundation and appearing in the file LICENSE included in the packaging of this file. Please review the following information to ensure the GNU General Public License version 3.0 requirements will be met: http://www.gnu.org/copyleft/gpl.html.
If you are unsure which license is appropriate for your use, please contact the sales department at http://www.sencha.com/contact.
*/
Ext.require([
'Ext.data.*',
'Ext.grid.*',
'Ext.tree.*'
]);
Ext.onReady(function() {
//we want to setup a model and store instead of using dataUrl
Ext.define('Task', {
extend: 'Ext.data.Model',
fields: [
{name: 'task', type: 'string'},
{name: 'user', type: 'string'},
{name: 'duration', type: 'string'}
]
});
var store = Ext.create('Ext.data.TreeStore', {
model: 'Task',
proxy: {
type: 'ajax',
//the store will get the content from the .json file
url: 'treegrid.json'
},
folderSort: true
});
//Ext.ux.tree.TreeGrid is no longer a Ux. You can simply use a tree.TreePanel
var tree = Ext.create('Ext.tree.Panel', {
title: 'Core Team Projects',
width: 500,
height: 300,
renderTo: 'tree-example',//2B的官方和SV黨們,這里竟然是getbody,bo你妹啊。
collapsible: true,
useArrows: true,
rootVisible: false,
store: store,
multiSelect: true,
singleExpand: true,
//the 'columns' property is now 'headers'
columns: [{
xtype: 'treecolumn', //this is so we know which column will show the tree
text: 'Task',
flex: 2,
sortable: true,
dataIndex: 'task'
},{
//we must use the templateheader component so we can use a custom tpl
xtype: 'templatecolumn',
text: 'Duration',
flex: 1,
sortable: true,
dataIndex: 'duration',
align: 'center',
//add in the custom tpl for the rows
tpl: Ext.create('Ext.XTemplate', '{duration:this.formatHours}', {
formatHours: function(v) {
if (v < 1) {
return Math.round(v * 60) + ' mins';
} else if (Math.floor(v) !== v) {
var min = v - Math.floor(v);
return Math.floor(v) + 'h ' + Math.round(min * 60) + 'm';
} else {
return v + ' hour' + (v === 1 ? '' : 's');
}
}
})
},{
text: 'Assigned To',
flex: 1,
dataIndex: 'user',
sortable: true
}]
});
});
分享:深入解析PHP中的(偽)多線程與多進(jìn)程本篇文章是對(duì)PHP中的(偽)多線程與多進(jìn)程進(jìn)行了詳細(xì)的分析介紹,需要的朋友參考下 (偽)多線程:借助外力 利用WEB服務(wù)器本身的多線程來(lái)處理,從WEB服務(wù)器多次調(diào)用我們需要實(shí)現(xiàn)多線程的程序。 QUOTE: 我們知道PHP本身是不支持多線程的, 但是我們的WEB服務(wù)器是支持多線程的.
- PHPNOW安裝Memcached擴(kuò)展方法詳解
- php記錄頁(yè)面代碼執(zhí)行時(shí)間
- PHP中獎(jiǎng)概率的抽獎(jiǎng)算法程序代碼
- apache設(shè)置靜態(tài)文件緩存方法介紹
- php對(duì)圖像的各種處理函數(shù)代碼小結(jié)
- PHP 關(guān)于訪問(wèn)控制的和運(yùn)算符優(yōu)先級(jí)介紹
- 關(guān)于PHP語(yǔ)言構(gòu)造器介紹
- php/js獲取客戶(hù)端mac地址的實(shí)現(xiàn)代碼
- php5.5新數(shù)組函數(shù)array_column使用
- PHP preg_match的匹配多國(guó)語(yǔ)言的技巧
- php 中序列化和json使用介紹
- php采集文章中的圖片獲取替換到本地
PHP教程Rss訂閱編程教程搜索
PHP教程推薦
- PHP多文件上傳的實(shí)例代碼
- xml php動(dòng)態(tài)載入與分頁(yè)
- 解答PHP上傳多個(gè)圖片并校驗(yàn)的代碼問(wèn)題
- PHP應(yīng)用:PHP在linxu下的安裝與配置
- 問(wèn)題解決:無(wú)法載入MYSQL擴(kuò)展,請(qǐng)檢查PHP配置
- PHP進(jìn)階技巧:如何避免表單的重復(fù)提交
- 深入phpMyAdmin的安裝與配置的詳細(xì)步驟
- 解讀PHP網(wǎng)站開(kāi)發(fā)需要掌握的10個(gè)技巧
- 解析用PHP操作MySql數(shù)據(jù)庫(kù)(DB類(lèi))
- 用PHP畫(huà)一個(gè)可以更換文字的按紐
- 相關(guān)鏈接:
- 教程說(shuō)明:
PHP教程-Extjs4 Treegrid 使用心得分享(經(jīng)驗(yàn)篇)
。