agGrid数据更改后刷新表格数据


非Server数据,用:rowData属性赋值的

对应的GridOptions属性

JavaScript 全选
gridOptions: {
  context: this,
  rowSelection: "single",
  rowHeight: 25,
  animateRows: true,
},

利用Ag-Grid表格的 applyTransaction 方法,注意该方法需要先设置表格的 getRowNodeId,不然会不起作用,参考:https://www.yesdotnet.com/archive/post/1617623423.html

JavaScript 全选
onCreate (data) {
  console.log(data)
  this.gridOptions.api.applyTransaction({ add: data })
},
onUpdate (data) {
  console.log(data)
  this.gridOptions.api.applyTransaction({ update: data })
}

Server数据

对应的Ag-Grid 属性gridOptions设置

JavaScript 全选
  gridOptions: {
	context: this,
	rowSelection: "single",
	rowHeight: 25,
	animateRows: true,
	rowModelType: "serverSide",
	serverSideStoreType: "partial",
	cacheOverflowSize: 2, //load状态显示两行
	pagination: true, // 分页
	suppressPaginationPanel: true, // 禁用分页面板
	paginationPageSize: 50,
  },

使用 refreshServerSideStore()方法

JavaScript 全选
    // 新增
    onCreate(data) {
      // this.gridOptions.api.refreshInfiniteCache();
      this.gridOptions.api.refreshServerSideStore();
    },
    // 更新
    onUpdate(data) {
      // this.gridOptions.api.refreshInfiniteCache();
      this.gridOptions.api.refreshServerSideStore();
    },

旧版本使用:

对应gridOptions属性设置

JavaScript 全选
gridOptions: {
  rowSelection: 'single',
  rowHeight: 25,
  rowModelType: 'infinite',
  cacheOverflowSize: 2, //load状态显示两行
  pagination: true,// 分页
  suppressPaginationPanel: true,// 禁用分页面板
  paginationPageSize: 50,
},

刷新数据方式:

JavaScript 全选
this.gridOptions.api.refreshInfiniteCache();

 

版权声明:本文为YES开发框架网发布内容,转载请附上原文出处连接
张国生
上一篇:vue 路由跳转的几种方式(带参数)
下一篇:Python资源包安装列表
评论列表

发表评论

评论内容
昵称:
关联文章

agGrid数据更改刷新表格数据
agGrid修改数据表格显示不刷新
AgGrid 改变数据表格刷新
AgGrid使用CellRendererFramework,修改数据调用applyTransaction数据刷新
AgGrid 刷新表格数据自动填充列宽度
明细页保存刷新A页面数据
AgGrid表格编辑功能
agGrid更新数据applyTransaction无效
AgGrid 选中第一行
GZDBHelper中Update方法,更新表格数据到数据库
AgGrid 删除一行数据自动移动焦点
IIS域名更改系统需要做的调整
devexpress gridview修改单元格值按回车没有立即刷新Summary,必须移动焦点行才行
百亿级数据 分库分表 怎么分页查询?
html img标签更改图片尺寸图片变得模糊
百亿级数据 分库分表 怎么分页查询?
系统登录默认显示可视化数据大屏
agGrid三种数据操作
EF并发处理,防止并发修改数据
YESWEB数据库更改APPID脚本

联系我们
联系电话:15090125178(微信同号)
电子邮箱:garson_zhang@163.com
站长微信二维码
微信二维码