Skip to content

Checkbox after navigate back #121

Open
@PabloPG

Description

@PabloPG

When I tap on checkbox icon and going to the next page (navigate) and then navigate back, this checkbox always preserve the state, but, if i use a buttom to call .toggle() and going to the next page and back, the state not preserve.

<RadListView
        #myRadListView
	[items]="listaDeProdutos"
	selectionBehavior="Press"
	(itemSelected)="onItemSelected($event)"
	(itemDeselected)="onItemDeselected($event)"
	marginBottom="8"
>
    <ng-template let-produto="item" let-index="index">
        <StackLayout backgroundColor="white" orientation="Vertical">
            <FlexboxLayout class="m-t-10" [ngClass]="{'situacao-item-selected': produto.IsSelected}">
                <FlexboxLayout justifyContent="center" class="produto-dados" flexDirection="column">
                    <Label text]="getProdutoDescricao(produto)" textWrap="true"></Label>
                    <Label text="{{ 'Quantidade: ' + produto.QuantidadeEstoque }}"></Label>
                 </FlexboxLayout>

		<CheckBox
                     #elem
                     [checked]="produto.IsSelected"
                     class="checkbox"
                     (checkedChange)="
                         elem.checked !== produto.IsSelected &&
                             selecionarProduto(produto)
                      "
                      boxType="circle"
                  >
                 </CheckBox>
            </FlexboxLayout>
        </StackLayout>
    </ng-template>
</RadListView>
public onItemSelected(args: ListViewEventData) {
    let radio = this.listViewComponent.listView.getViewById("cb-" + args.index);
    const produto = this.listaDeProdutos.getItem(args.index);
    if (!produto.IsSelected) {
        console.dir(radio.nativeView.isChecked()); // Return false
	radio.nativeView.toggle();
	setTimeout(() => console.dir(radio.nativeView.isChecked()), 1000); // Retun true;
    }
}

Tap inside the checkbox have ripple effect:
https://media.giphy.com/media/H3pfYiz0XlbKqnImw3/giphy.gif

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions