// {{ formatter function format_boolean(value, trueValue, falseValue) { if (value == "1" || value == "true") { return trueValue; } return falseValue; } function format_YesNo(value) { if (value == 0 || value === false) { return "否"; } return "是"; } window.format_yesNo = format_YesNo; function format_status(value) { if (value == -1) { return "未启用"; } if (value == 0 || value === false) { return "停用"; } return "启用"; } function format_Time(value, format) { if (value == null || value == 'null' || value == '') { return ''; } if (K.isNumber(value)) { return new Date(value).format(); } return value; // return new Date(value).format(); } window.format_time = format_Time; function format_Date(value) { if (value == null || value == 'null' || value == '') { return ''; } if (K.isNumber(value)) { return new Date(value).format("yyyy-MM-dd"); } return value.substr(0, 10); // return new Date(value).format("yyyy-MM-dd"); } window.format_date = format_Date; /** * 需要通过bind注入url,datagrid * * @param value * @param row * @param index * @returns {String} */ function format_sortIcon(value, row, index) { if (!this.url || !this.datagrid) { return ""; } // 非正规API获取数据 var datagridData = $(this.datagrid).data("datagrid"); var data = datagridData.data; var rows = data.rows; // 现在认为列表总是分页的 var status = { up : true, down : true }; if (index == 0) { status.up = false; } if (rows.length == index + 1) { status.down = false; } return K.dg.sortIconTpl({ value : value, row : row, status : status, datagrid : this.datagrid, url : this.url }); } // }}