Table editor @update event


Topic: Table editor @update event

tnhnet pro premium priority asked a year ago

Expected behavior

Table editor should fire @update event after editing and on deleting

Actual behavior

Table editor only fire @update event on delete only

Resources (screenshots, code snippets etc.)

   <MDBTableEditor
    v-model:dataset="dataset"
    @update="onEditorUpdate"
  ></MDBTableEditor>

    const onEditorUpdate = (event) => {
       // only fire on delete
      console.log('onEditorUpdate', event)
    }

Bartosz Cylwik staff answered a year ago

Hi. I fresh installed an app with table editor plugin (2.0.2). From what I can see my @update event is emitting on edit aswell. What version of table editor are you using? Maybe you could check if @updateEntry event is firing for you properly. Best Regards!


tnhnet pro premium priority commented a year ago

I was running 2.0.1, I updated to 2.0.2 and the issue still presist. I added @updateEntry doesn't make any difference


Bartosz Cylwik staff commented a year ago

Have you tried removing node_modules and installing again? Could you check in node_modules if table editor shows version 2.0.2? If that won't help, and if it's possible, maybe you could show us your code (only the editor table part) somewhere? Can be here, github or email.


tnhnet pro premium priority commented a year ago

yes, i double checked and it says mdb-vue-table-editor@2.0.2" the code is basically what I shared in the original post, where dataset = const dataset = ref({ columns: [ {label: 'Label', field: 'label'}, {label: 'Unit', field: 'unit'}, {label: 'Unit Type', field: 'unit_type', inputType: 'select', options: ['gram', 'unit']}, {label: 'Cost', field: 'cost'}, {label: 'Price', field: 'price'}, {label: 'Min', field: 'minimum'}, {label: 'Max', field: 'maximum'}, {label: 'Enabled', field: 'enabled', inputType: 'checkbox'}, ], rows: product.value.product_prices })


Bartosz Cylwik staff commented a year ago

I'm not really sure what could cause the problem. I've checked and on our side the events are working, your code is working for me aswell. The update event is firing after click on a save button. Have you tried checking on a new project if anything changes?


tnhnet pro premium priority commented a year ago

I figured it out, the data passed to rows should only contain the fields defined in columns only. otherwise it doesn't fire update or updateEntry events


Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Answered

Specification of the issue
  • User: Pro
  • Premium support: Yes
  • Technology: MDB Vue
  • MDB Version: MDB5 3.1.1
  • Device: Any
  • Browser: Any
  • OS: Any
  • Provided sample code: No
  • Provided link: No