Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
65
igTextEditor
posted

Hi,

How can i default the focus on the igTextEditor when i instantiate the control with knockout like  <div id="customerNameIG" class="row-control" data-bind="igTextEditor: {}"></div>, any help is appreciated.

Thanks

Parents Reply
  • 60
    Verified Answer
    Offline posted in reply to Mohd Shameer

    Dear Mohd Shameer,

    Please be advised that you may bind to the rendered event of our control and then simply call the setFocus method.

    The first option would be to add the rendered event handler to the viewModel:

    const viewModel = {
    		customerName: ko.observable("Mark"),
    		rendered: function(evt, ui) {
    			$('#control').igTextEditor('setFocus');
    	}
    }

    And then simply to the following:

    <div id="control" data-bind="igTextEditor: { value: customerName, rendered }"></div>

    The second option would be to directly add the handler to the markup, like so:

    <div id="control" data-bind="igTextEditor: { 
    									value: customerName, 
    									rendered: function(evt, ui) {
    										$('#control').igTextEditor('setFocus');
    									}
    								}"></div>

    You may refer to the two samples that are attached to this reply for additional information.

    Of course, if there is anything else that you need assistance with, please do contact us again.

    igTextEditor_Knockout_Binding.zip

Children