HTML擴展方式navTab, dialog, ajaxTodo 的url支持變量替換。例如:__URL__/edit/id/{xxx}
大括號內(nèi)的xxx就是變量名,主要功能是結(jié)合table組件一起使用,下面是dwz_thinkphp中用戶列表的示例:
下圖中的刪除、編輯、修改密碼都是用了url變量替換:
刪除、編輯、修改密碼使用了變量{sid_user}
<tbody>中<tr target="sid_user"rel="{$vo['id']}">
當選中一行時,tr上的rel值會自動替換到url變量中.
注意url變量名{sid_user}和tr的target="sid_user"保持一致.
代碼示例:
<aclass="delete" href="__URL__/foreverdelete/id/{sid_user}/navTabId/__MODULE__"target="ajaxTodo" title="你確定要刪除嗎?" warn="請選擇用戶"><span>刪除</span></a>
<aclass="edit" href="__URL__/edit/id/{sid_user}"target="dialog" mask="true"warn="請選擇用戶"><span>編輯</span></a>
<aclass="icon" href="__URL__/password/id/{sid_user}"target="dialog" mask="true"warn="請選擇用戶"><span>修改密碼</span></a>
<tableclass="list" width="100%"layoutH="116">
<thead>
<tr>
<th width="60">編號</th>
<th width="100">用戶名</th>
<th>昵稱</th>
<th>Email</th>
<th width="100">添加時間</th>
<th width="120">上次登錄</th>
<th width="80">登錄次數(shù)</th>
<th width="80">狀態(tài)</th>
</tr>
</thead>
<tbody>
<volist id="vo" name="list">
<tr target="sid_user"rel="{$vo['id']}">
<td>{$vo['id']}</td>
<td>{$vo['account']}</td>
<td>{$vo['nickname']}</td>
<td>{$vo['email']}</td>
<td>{$vo['create_time']|date="Y-m-d",###}</td>
<td>{$vo['last_login_time']|date="Y-m-dH:i:s",###}</td>
<td>{$vo['login_count']}</td>
<td>{$vo['status']|showStatus=$vo['id']}</td>
</tr>
</volist>
</tbody>
</table>
checkbox全選、反選<label><input type="checkbox"name="c1" value="1" />選擇1</label>
<label><input type="checkbox"name="c1" value="2" />選擇2</label>
<label><input type="checkbox"name="c1" value="3" />選擇3</label>
<input type="checkbox"class="checkboxCtrl" group="c1" />全選
<button type="button" class="checkboxCtrl" group="c1" selectType="invert">反選</button>
uploadify多文件上傳<div id="fileQueue"class="fileQueue"></div>
<input id="testFileInput" type="file" name="image"
uploader="uploadify/scripts/uploadify.swf"
cancelImg="uploadify/cancel.png"
script="ajaxDone.html"
scriptData="{PHPSESSID:'xxx', ajax:1}"
folder="/folder"
fileQueue="fileQueue"
[onComplete="uploadifyComplete"]
[onAllComplete="uploadifyAllComplete"] />
參數(shù)說明:name: 文件名
filePath: 上傳文件在服務(wù)器端的路徑size: 文件的大小
creationDate:文件創(chuàng)建的時間
modificationDate:文件最后更改的時間
type:是以"."開始的文件擴展名
fileCount:上傳隊列中還剩下的文件數(shù)speed:以KB/s為單位的文件上傳平均速度
filesUploaded: 已經(jīng)上傳的文件總數(shù)
errors: 上傳出錯的文件總數(shù)
allBytesLoaded:已經(jīng)上傳文件的總大小
speed: 以KB/s為單位的上傳文件的平均速度
以下3個方法是dwz.ajax.js中定義的用于文件上傳的會調(diào)函數(shù):
function uploadifyAllComplete(event, data){
if (data.errors) {
var msg = "The totalnumber of files uploaded: "+data.filesUploaded+"\n"
+ "The totalnumber of errors while uploading: "+data.errors+"\n"
+ "The totalnumber of bytes uploaded: "+data.allBytesLoaded+"\n"
+ "The averagespeed of all uploaded files: "+data.speed;
alert("event:" +event + "\n" +msg);
}
}
function uploadifyComplete(event, queueId, fileObj, response, data){
DWZ.ajaxDone(DWZ.jsonEval(response));
}
function uploadifyError(event, queueId, fileObj, errorObj){
alert("event:" +event + "\nqueueId:" +queueId + "\nfileObj.name:"
+ fileObj.name + "\nerrorObj.type:"+ errorObj.type + "\nerrorObj.info:"+ errorObj.info);
}
更多建議: