Coder Social home page Coder Social logo

Comments (5)

Sight-wcg avatar Sight-wcg commented on June 5, 2024 4

Duplicate of #1483

from layui.

bxjt123 avatar bxjt123 commented on June 5, 2024 2

trigger实际上也可以,隐藏操作栏按钮即可,以下仅供参考

<table class="layui-hide" id="ID-test-table"></table>
<script type="text/html" id="ID-demo-table-tool">
  <a class="layui-btn layui-btn-primary layui-btn-xs layui-hide" lay-event="edit">编辑</a>
  <!--其他按钮-->
</script>

table.render({
  elem: '#ID-test-table',
  //其他属性
  cols: [[
    //其他列
    {field: 'city', title: '城市'},
    {title: '操作', toolbar: '#ID-demo-table-tool'}
  ]]
});
table.on('tool(ID-test-table)', function(obj) {
  var data = obj.data;
  var layEvent = obj.event;
  if (layEvent === 'edit') {
    obj.update({city:"更新"+data.id}); //更新某个单元格
  }
});
//以下放在需要更新的地方 layui-table-main限定主表格 防止右固定列重复执行
$(".layui-table-main .layui-table-cell>a[lay-event=edit]").trigger("click");

1

from layui.

chenxiaobozhang avatar chenxiaobozhang commented on June 5, 2024 2

感谢大佬新增 table.updateRow 方法 ,完美解决我的问题!超级点赞!

from layui.

LSL1618 avatar LSL1618 commented on June 5, 2024

目前为止只能使用reload()重载方法,未来可能会有getRow()、setRow()之类的获取或更新行方法。

from layui.

chenxiaobozhang avatar chenxiaobozhang commented on June 5, 2024

我有100行数据,每行数据后面有10个按钮,每个按钮都绑定了事件,而状态列每秒更新一次,难道只能每秒reload一次么?
肯定是类似tool事件的update方法效率更高啊,但是又没法使用tool事件,好难受

from layui.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.