nova-json icon indicating copy to clipboard operation
nova-json copied to clipboard

Delete row error

Open ss071109 opened this issue 2 years ago • 2 comments

HI,

I have a json format like : {"type": "'', "default":'', "options": [{name:'xxx', label:'ooo',fee:100},...]}

This json in db table namely data.

In nova 4 resource, i have call JsonRepeatable class like :


$fields[] = JsonRepeatable::make('data->options')->fullWidth()
                                          ->stacked()
                                          ->rules([
                                              'array',
                                          ])
                                          ->fields([
                                              Hidden::make('name')
                                                    ->readonly(),
                                              Text::make('label')
                                                  ->rules([ 'required' ]),
                                              Number::make('fee')
                                                    ->step(0.1)
                                                    ->rules([ 'min:0', 'max:999999', 'required' ])
                                          ]);

螢幕截圖 2023-06-13 下午6 29 41

In update page, i have click a top row delete button but a last row deleted.The target row no delete.

I have view file(vendor/stepanenko3/nova-json/resources/js/components/Fields/JsonRepeatable/FormField.vue:103) function deleteRow().

螢幕截圖 2023-06-13 下午6 20 25

console.log(this.value) result is the target row deleted but display is last row deleted.

Can i know how to fix the error to display the correct information?

P.s 1 : I try to fix the error refer https://stackoverflow.com/questions/48484773/splice-not-working-properly-my-object-list-vuejs. Also not working.

ss071109 avatar Jun 13 '23 10:06 ss071109

I find this https://plainenglish.io/blog/many-ways-to-rerender-a-vue-component-660376d94cc1 can fix the display error.

Use vue v-if to reload display list can display the correct information.

ss071109 avatar Jun 13 '23 13:06 ss071109

I find this https://plainenglish.io/blog/many-ways-to-rerender-a-vue-component-660376d94cc1 can fix the display error.

Use vue v-if to reload display list can display the correct information.

Please update plugin.

Thanks. I'm too. Thanks.

jaycom avatar Jun 13 '23 13:06 jaycom