Base icon indicating copy to clipboard operation
Base copied to clipboard

Not checked checkbox in ItemListStatusButton and ItemListTree

Open GreenBabyBorn opened this issue 2 years ago • 2 comments

Checkboxes are not checked when the page loads, although they should. The problem was in a non-strict condition Solution for ItemListTree.vue:

<button class="btn-status me-2" type="button" @click="toggleStatus(node)">
  <span v-if="translatable" :class="node.data.status_translated == 1 ? 'btn-status-icon-on' : 'btn-status-icon-off'" class="btn-status-icon"></span>
  <span v-else :class="node.data.status == 1 ? 'btn-status-icon-on' : 'btn-status-icon-off'" class="btn-status-icon"></span>
</button>

Solution for ItemListStatusButton.vue:

statusOn() {
            if (typeof this.model.status_translated === 'undefined') {
                return parseInt(this.model.status) == '1';
            } else {
                return this.model.status_translated == '1';
            }
        },

GreenBabyBorn avatar Nov 30 '23 22:11 GreenBabyBorn

I need more info to correctly understand what you mean here.

sdebacker avatar Dec 01 '23 08:12 sdebacker

I need more info to correctly understand what you mean here.

For example, when I open the "/admin/pages" page, each page has a checkbox that shows whether the page is published or not. By default, all pages are published and when the page loads, the checkboxes should be active, but they are not active. This is due to the fact that a strict comparison was used in the component checkbox.webm

GreenBabyBorn avatar Dec 01 '23 10:12 GreenBabyBorn