We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Using CheckBox with TypeScript & KnockoutJS

I seem to be having trouble syncing a ejCheckBox with KnockoutJS to my view model.

<input
    type="checkbox"
    id="canEditCheckBox"
    data-bind="checked: myView().canEdit()" />

The following code by itself works fine. However when I create a ej.CheckBox in code it no longer binds to the check data

this.canEditCheckBox = new ej.CheckBox($("#canEditCheckBox"), {
    size: "medium",
    enableTriState: false,
    enabled: true
});

I've also tried to bind set the check value within the ej.CheckBox but it does not work either, i.e. is not updated.

Also I've changed the HTML binding but again it doesn't work.

<input
    type="checkbox"
    id="canEditCheckBox"
    data-bind="ejCheckBox: {checked: myView().canEdit()}" />

Is this entirely possible? I've looked through JavaScript & TypeScript demo and can't see anything to help.

1 Reply

PK Prem Kumar Madhan Raj Syncfusion Team January 16, 2017 11:37 AM UTC

Hi Garet,   
   
Thank you for contacting Syncfusion support,   
   
We have checked your requirement for binding ViewModel data with Checkbox and was unable to reproduce the reported issue.    
   
We have created a simple sample based on your requirement.    
   
If this is not the scenario you are trying to achieve, then please let us know with the edited sample to replicate the reported issue, so, that we could find a solution.   
   
Regards,   
Prem Kumar Madhan Raj.   


Loader.
Live Chat Icon For mobile
Up arrow icon