当前位置:网站首页>Tips for using jeditabletable

Tips for using jeditabletable

2022-07-07 08:31:00 OK_ boom

JEditableTable Use the default criteria to query

JEditableTable By weaving in JeecgListMixin To implement the query ,created Priority will be given to implementation JVxeTableModelMixin Of created, So priority will be given to load once data.
Fortunately, it has a switch to turn it off and automatically load data .
In our own inquiry vue Processing , stay data Add in disableMixinCreated:true And in created You can load the data manually .

created() {
  this.getSuperFieldList()
  this.$nextTick(()=>{
    if (this.type=='purchase'){
      this.$set(this.queryParam,'approved',"1")
    }
    this.loadData();
    // Initialize dictionary configuration   Define on your own page 
    this.initDictConfig();
  })
}

JEditableTable Modify the default value of the record

There's been a lot of attempts , Finally, make sure to modify JEditableTable Of dataSource And it needs to trigger its monitoring function to load new data into the interface , but JEditableTable Of dataSource No listening deep, It needs to be added to monitor dataSource Changes in content .

dataSource: {
    
        immediate: true,
        deep: true,
        handler: function (newValue) {
    
          //  compatible IE
          this.getElementPromise('tbody').then(() => {
    
            this.initialize()
            this._pushByDataSource(newValue)
          })
        }
      },

The following is to be achieved , When data linkage makes JEditableTable Inside select Type of field options Refresh again and JEditableTable The value of this field of all records is cleared

async prodCatChange(value){
    
//tbVendor  yes JEditableTable example 
      let tbVendor = await getRefPromise(this, 'smpProductVendor')
      let column=tbVendor.columns.filter(m=>m.key=='vendorId')[0]
      column.options=[]// Must empty , Otherwise, the superposition will be recorded 
      tbVendor._loadDictConcatToOptions(column)
      let dataSource=this.smpProductVendorTable.dataSource
      dataSource.forEach(item=>{
    
        item.vendorId='.'
      })
      dataSource.forEach(item=>{
    
        item.vendorId=''
      })
    },      

Why should we put vendorId Set twice ? Because if you set it once , Repeat this method and it will not trigger again tbVendor Of dataSource monitor .

 Insert picture description here

原网站

版权声明
本文为[OK_ boom]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/188/202207070527058045.html