Ag-Grid整理

API文档地址

英文API文档:https://www.ag-grid.com/
中文API文档:https://www.itxst.com/ag-grid/tutorial.html

组件用法

<!-- 数据列表 -->
<ag-grid-vue ref="multipleTable" class="table ag-theme-balham" :columnDefs="columnDefs" :rowData="rowData" 
		@grid-ready="onGridReady" :defaultColDef="defaultColDef" @selection-changed="onSelectionChanged" 
		:rowSelection="rowSelection" :enableBrowserTooltips="true" :stopEditingWhenCellsLoseFocus="false"
		@cell-value-changed="onCellValueChanged" :isRowSelectable="isRowSelectable" :editType="editType"
		:suppressRowClickSelection="suppressRowClickSelection" :suppressClickEdit="suppressClickEdit"
		:sideBar="sideBar" :components="components" :excelStyles="excelStyles">
</ag-grid-vue>

属性含义

  1. class 表格主题
class="table ag-theme-balham" 
Ag-Grid表格的主题有 5 种
① ag-theme-alpine
② ag-theme-alpine-dark
③ ag-theme-balham
④ ag-theme-balham-dark
⑤ ag-theme-material
样式种类整理参照来源:https://blog.csdn.net/WQearl/article/details/106636786 
  1. columnDefs 定义表格列
  2. rowData 表格展示的数据
data() {
   
	return {
   
		columnDefs: null, //表格默认展示列
		rowData: null, //画面显示表格数据,查询后赋值
	}
},
beforeMount() {
   
	this.columnDefs = [{
   
			// ID
			headerName: 'ID', //序号
			field: 'id',
			hide: true //默认不显示
		},
		{
   
			// 姓名
			headerName: '姓名', //表格显示列名
			field: 'name', //该列对应的后台返回数据中的Key
			tooltipField: 'name', //鼠标悬浮是单元格内容的tooltip提示
			checkboxSelection: true, //该列前带CheckBox复选框
			pinned: 'left', //设置当前列为固定列,且固定在左侧
			width: 90, //宽度
			minWidth: 90, //最小宽度
		},
		{
   
			// 年龄
			headerName: '年龄',
			field: 'age',
			tooltipField: 'age'
		}
	
  • 0
    点赞
  • 23
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
ag-Grid Vue 是一个用于构建灵活的、高性能的数据表格和数据网格的 Vue 组件库。它是与 Vue 框架集成的 ag-Grid 社区版。使用 ag-Grid Vue,您可以轻松地在 Vue 应用程序中创建功能丰富的数据表格和网格,并利用 ag-Grid 提供的丰富功能和性能优势。 要在 Vue 应用程序中使用 ag-Grid Vue,您需要先安装 ag-Grid Vue 包。您可以使用 npm 或 yarn 进行安装: ```bash npm install --save ag-grid-vue # 或 yarn add ag-grid-vue ``` 安装完成后,您可以在 Vue 组件中引入并使用 ag-Grid Vue: ```vue <template> <ag-grid-vue :columnDefs="columnDefs" :rowData="rowData" class="ag-theme-alpine" ></ag-grid-vue> </template> <script> import { AgGridVue } from 'ag-grid-vue'; export default { components: { AgGridVue, }, data() { return { columnDefs: [...], // 列定义 rowData: [...], // 行数据 }; }, }; </script> <style> @import '~ag-grid-community/dist/styles/ag-grid.css'; @import '~ag-grid-community/dist/styles/ag-theme-alpine.css'; </style> ``` 在上面的示例中,您可以通过传递列定义(columnDefs)和行数据(rowData)来配置 ag-Grid Vue 组件。您还需要为 ag-Grid 使用的主题样式添加对应的 CSS。 只是一个简单的示例,您可以根据您的需求和数据结构进行更多的配置和自定义。您可以参考 ag-Grid Vue 的官方文档以获取更多详细信息和示例代码。希望这可以帮助您开始使用 ag-Grid Vue!如果有任何其他问题,请随时提问。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值