easyui中 field: 'applicationApt', title: '申请部门', width: 100, 设置如果value是10011 显示事业部怎么设置

时间: 2024-02-03 21:02:04 浏览: 23
如果你想在 EasyUI 的表格中,将字段值为 10011 显示为 "事业部",可以使用 `formatter` 函数来实现。以下是修改后的代码示例: ```javascript <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Excel-like Table</title> <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/easyui/dist/themes/default/easyui.css"> <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/easyui/dist/themes/icon.css"> <script src="https://cdn.jsdelivr.net/npm/jquery/dist/jquery.min.js"></script> <script src="https://cdn.jsdelivr.net/npm/easyui/dist/jquery.easyui.min.js"></script> <style> #dg { width: 100%; height: 400px; } </style> </head> <body> <table id="dg" class="easyui-datagrid" data-options=" url: 'get_data.php', // 替换成获取数据的 URL singleSelect: true, fitColumns: true, toolbar: '#toolbar', pagination: true, pageSize: 20, pageList: [10,20,30,40,50], rownumbers: true, striped: true, columns: [[ {field:'id',title:'序号',width:60}, {field:'requestNumber',title:'申请单号',width:100}, {field:'documentName',title:'用印文件名称',width:150}, {field:'copyCount',title:'用印份数',width:80}, {field:'department',title:'申请部门',width:100, formatter: formatDepartment}, {field:'applicant',title:'申请人',width:100}, {field:'requestDate',title:'申请日期',width:100} ]] "> </table> <div id="toolbar"> <a href="#" class="easyui-linkbutton" iconCls="icon-add" plain="true">Add</a> <a href="#" class="easyui-linkbutton" iconCls="icon-edit" plain="true">Edit</a> <a href="#" class="easyui-linkbutton" iconCls="icon-remove" plain="true">Remove</a> </div> <script> function formatDepartment(value) { if (value === '10011') { return '事业部'; } return value; } </script> </body> </html> ``` 在上述代码中,我们添加了一个名为 `formatDepartment` 的函数,并将其作为 `formatter` 函数指定给了申请部门的列。在 `formatDepartment` 函数中,我们检查字段值是否为 `10011`,如果是,则返回字符串 `'事业部'`,否则返回原始值。这样就能实现将字段值为 `10011` 的显示为 `'事业部'`。

相关推荐

最新推荐

recommend-type

jQuery EasyUI编辑DataGrid用combobox实现多级联动

本文给大家分享jQuery EasyUI编辑DataGrid用combobox实现多级联动效果的实例代码,代码简单易懂,非常不错,具有参考借鉴价值,感兴趣的朋友一起看看吧
recommend-type

easyui combogrid实现本地模糊搜索过滤多列

本篇文章主要介绍了easyui combogrid实现本地模糊搜索过滤多列,非常具有实用价值,需要的朋友可以参考下
recommend-type

easyui datagrid 大数据加载效率慢,优化解决方法(推荐)

下面小编就为大家带来一篇easyui datagrid 大数据加载效率慢,优化解决方法(推荐)。小编觉得挺不错的,现在就分享给大家,也给大家做个参考。一起跟随小编过来看看吧
recommend-type

easyui textbox失去焦点事件及获取文本框的内容

easyui textbox失去焦点事件及获取文本框的内容easyui textbox失去焦点事件及获取文本框的内容easyui textbox失去焦点事件及获取文本框的内容
recommend-type

Easyui更换皮肤使用方法

jquery-easyui更换皮肤方法说明皮肤下载地址:http://jeasyui.com/extension/themes.php Cookie插件下载地址:http://jqueryui.com/download/
recommend-type

zigbee-cluster-library-specification

最新的zigbee-cluster-library-specification说明文档。
recommend-type

管理建模和仿真的文件

管理Boualem Benatallah引用此版本:布阿利姆·贝纳塔拉。管理建模和仿真。约瑟夫-傅立叶大学-格勒诺布尔第一大学,1996年。法语。NNT:电话:00345357HAL ID:电话:00345357https://theses.hal.science/tel-003453572008年12月9日提交HAL是一个多学科的开放存取档案馆,用于存放和传播科学研究论文,无论它们是否被公开。论文可以来自法国或国外的教学和研究机构,也可以来自公共或私人研究中心。L’archive ouverte pluridisciplinaire
recommend-type

实现实时数据湖架构:Kafka与Hive集成

![实现实时数据湖架构:Kafka与Hive集成](https://img-blog.csdnimg.cn/img_convert/10eb2e6972b3b6086286fc64c0b3ee41.jpeg) # 1. 实时数据湖架构概述** 实时数据湖是一种现代数据管理架构,它允许企业以低延迟的方式收集、存储和处理大量数据。与传统数据仓库不同,实时数据湖不依赖于预先定义的模式,而是采用灵活的架构,可以处理各种数据类型和格式。这种架构为企业提供了以下优势: - **实时洞察:**实时数据湖允许企业访问最新的数据,从而做出更明智的决策。 - **数据民主化:**实时数据湖使各种利益相关者都可
recommend-type

用matlab绘制高斯色噪声情况下的频率估计CRLB,其中w(n)是零均值高斯色噪声,w(n)=0.8*w(n-1)+e(n),e(n)服从零均值方差为se的高斯分布

以下是用matlab绘制高斯色噪声情况下频率估计CRLB的代码: ```matlab % 参数设置 N = 100; % 信号长度 se = 0.5; % 噪声方差 w = zeros(N,1); % 高斯色噪声 w(1) = randn(1)*sqrt(se); for n = 2:N w(n) = 0.8*w(n-1) + randn(1)*sqrt(se); end % 计算频率估计CRLB fs = 1; % 采样频率 df = 0.01; % 频率分辨率 f = 0:df:fs/2; % 频率范围 M = length(f); CRLB = zeros(M,1); for
recommend-type

JSBSim Reference Manual

JSBSim参考手册,其中包含JSBSim简介,JSBSim配置文件xml的编写语法,编程手册以及一些应用实例等。其中有部分内容还没有写完,估计有生之年很难看到完整版了,但是内容还是很有参考价值的。