EasyUI Forum
March 28, 2024, 06:01:41 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: RadioButtonComponent doesn't work  (Read 2299 times)
khan
Newbie
*
Posts: 13


View Profile
« on: June 04, 2022, 01:56:58 PM »

I have tested with your radio button demo example. I get nativeElement error. Probably this.inputRef has null value at get checked() method. So Can't read native element property. Where is my wrong?

Code:
class RadioButtonComponent extends ValueAccessorBase {
    constructor() {
        super(...arguments);
        this.name = null;
        this.disabled = false;
        this.inputId = null;
    }
    get checked() {
        return this.inputRef.nativeElement.checked;
    }
    writeValue(value) {
        if (this.value == value) {
            this.inputRef.nativeElement.checked = true;
        }
    }
    onClickButton(event) {
        this.select();
    }
    onChange(event) {
        this.select();
    }
    select() {
        if (this.disabled) {
            return;
        }
        this.inputRef.nativeElement.checked = true;
        this._changed.forEach(f => f(this.value));
    }
}
Logged
jarry
Administrator
Hero Member
*****
Posts: 2260


View Profile Email
« Reply #1 on: June 05, 2022, 02:10:02 AM »

Please update to the newest version.
Logged
khan
Newbie
*
Posts: 13


View Profile
« Reply #2 on: June 05, 2022, 02:45:15 PM »

There is a new problem at version 1.3.3. "ComboBoxComponent.onDocumentClick" gives undefined "nativeElement" error.

Code:
    // @HostListener('document:click', ['$event'])
    onDocumentClick(event) {
        if (!this.disabled && !this.editable) {
            if (domHelper.isChild(event.target, this.inputRef.nativeElement)) {
                event.stopPropagation();
                this.togglePanel();
                return false;
            }
        }
        if (this.panelRef) {
            event.stopPropagation();
            if (domHelper.isChild(event.target, this.hostRef.nativeElement)) {
                return false;
            }
            if (!domHelper.isChild(event.target, this.panelRef.nativeElement)) {
                this.closePanel();
            }
        }
    }
Logged
jarry
Administrator
Hero Member
*****
Posts: 2260


View Profile Email
« Reply #3 on: June 06, 2022, 04:00:03 AM »

This issue has been fixed. Please update to the newest version.
Logged
khan
Newbie
*
Posts: 13


View Profile
« Reply #4 on: June 06, 2022, 04:39:15 AM »

Version 1.3.4 works perfectly. Thank you @jarry.
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!