<script>
function demobar(value, rowData, rowIndex) {
var demostr = "<div class='easyui-progressbar progressbar easyui-fluid' style='width:398px'><div class='progressbar-text' style='width:398px;'>"+ value + "</div><div class='progressbar-value' style='width:"+ value + ";background-color:#CCC'> </div></div>";
return demostr;
}
$(function() {
$('#demo').datagrid( {
url : 'datagrid_progressbar.json',
columns : [ [ {
field : 'task',
title : '任务',
}, {
field : 'progress',
title : '进度',
formatter : demobar
} ] ]
});
});
</script>
<body><table id="demo" style="width: 460px"></table></body>
json文件内容: