KendoUi控件kendoGrid中template中条件判断的使用
来源:程序员人生 发布时间:2015-04-02 08:37:54 阅读次数:7745次
根据dataSource中提供的值渲染出来的页面效果以下:
最后1列的操作,根据是不是已处理来显示“回收”的操作按钮。
相干代码以下,主要是template中使用条件判断语句的方式:
var kendoGridPermissionApplys = $("#kendo_grid_permission_applys").kendoGrid(
{
dataSource:{
data:<?php echo $test;?>
},
sortable: true,
scrollable: false,
selectable: true,
pageable:{
messages:{
display: "<?php echo
Yii::t('default', 'Showing {0}-{1} from {2} data items'); ?>",
empty: "<?php echo
Yii::t('default', 'No items to display'); ?>",
first: "<?php echo
Yii::t('default', 'Go to the first page'); ?>",
previous: "<?php echo
Yii::t('default', 'Go to the previous page'); ?>",
next: "<?php echo
Yii::t('default', 'Go to the next page'); ?>",
last: "<?php echo
Yii::t('default', 'Go to the last page'); ?>"
}
},
columns:[
{
field:"apply_from",
title: "<?php echo
Yii::t('default', 'Apply From'); ?>"
},
{
field:"apply_contents",
title: "<?php echo
Yii::t('default', 'Apply Contents'); ?>"
},
{
field:"apply_status",
title: "<?php echo
Yii::t('default', 'Apply Status'); ?>"
},
{
field:"apply_create_time",
title: "<?php echo
Yii::t('default', 'Apply Create Time'); ?>"
},
{
template:
"<a class='k-button' href='index.php?r=apply/admin/showapply&apply_id=#=apply_id#&apply_from=#=apply_from#' style='min-width:24px'>查看</a><a class='k-button' style='min-width:24px' onclick='IfGoToDistributePermission(#=apply_id# ,#=apply_status_en#)'>分配</a>" +
"# if (apply_status_en == 2) { #" +
"<a class='k-button' onclick='RecyclePermission(#=apply_id#)'>回收</a>" +
"# } #",
title:"<?php echo
Yii::t('default', 'Operate'); ?>"
}
]
}).data("kendoGrid");
生活不易,码农辛苦
如果您觉得本网站对您的学习有所帮助,可以手机扫描二维码进行捐赠