zoukankan      html  css  js  c++  java
  • element ui中表格table翻页记忆勾选状态

     <el-table ref="multipleTable" :data="datalist" style="100%" @select="handleselectRow" @select-all="handleselectAll" size="small" >
      <el-table-column type="selection" prop="houseId" align="center"></el-table-column>
    </el-table>
      //初始化列表数据
     init(currentPage, pageSize) {
          let _this = this;
          let parmas = {
            currentPage: currentPage,
            pageSize: pageSize,
            communityId: this.form.communityId,
            companyId: this.form.companyId
          };
    
          // this.Utils.exeuhttpResquestGet(this.apiUrls.communityManagement.getTableData, {}, result => {
          _this.Utils.exeuhttpResquestPost(this.apiUrls.rate.selectHouseInfoRate, parmas, result => {
            _this.datalist = result.data.data.dataList;
            _this.total = result.data.data.totalCount;
            _this.$nextTick(function () {
              _this.memoryChecked();
            })
          });
        },
        //行选中函数  若有删除,若无添加
        handleselectRow(selection, row) {
          if (this.selectObj[row.houseId]) {
            delete this.selectObj[row.houseId]
          } else {
            this.selectObj[row.houseId] = row.houseId
          }
        },
        //全选函数  点击全选遍历当页数据若无添加,若是反选则删除(判断是否是全选还是反选)
        handleselectAll(selection) {
          this.datalist.forEach((row, index) => {
            if (this.selectObj.hasOwnProperty(row.houseId)) {
              selection.length ? null : delete this.selectObj[row.houseId]
            } else {
              this.selectObj[row.houseId] = row.houseId
            }
          });
        },
        //记忆函数
        memoryChecked(){
          this.datalist.forEach((row, index) => {
            if (this.selectObj.hasOwnProperty(row.houseId)) {
              this.$refs.multipleTable.toggleRowSelection(row, true);    
            } else {
              this.$refs.multipleTable.toggleRowSelection(row, false);
            }
          });
        },
    

      

  • 相关阅读:
    IDEA永久激活方法
    idea在本地调试,spark创建hiveContext的时候报错
    MVC里面调用webservice
    log4net配置
    Linq 使用skip和take分页
    ASP.NET页面之间传递值的几种方式
    C#操作redis
    C#知识点:I/O
    C#知识点:ref和Out关键字浅谈
    C#知识点:反射
  • 原文地址:https://www.cnblogs.com/samsara-yx/p/11236713.html
Copyright © 2011-2022 走看看