Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not checked checkbox in ItemListStatusButton and ItemListTree #271

Open
GreenBabyBorn opened this issue Nov 30, 2023 · 2 comments
Open

Not checked checkbox in ItemListStatusButton and ItemListTree #271

GreenBabyBorn opened this issue Nov 30, 2023 · 2 comments

Comments

@GreenBabyBorn
Copy link

GreenBabyBorn commented Nov 30, 2023

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';
            }
        },
@sdebacker
Copy link
Contributor

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

@GreenBabyBorn
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants