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
Hello Mohd Shameer,
Thank you for posting in our forum.
Please be advised that you may set the focus on the control by using the setFocus method.This could be achieved upon initialization as well as on an already initialized control.
Please refer to the following address for more information – setFocus
You may also look at the attached sample, which should provide you with more details on how you may achieve it yourself.
Please be sure to contact us again should you require any additional assistance.igTextEditor_Sample.zip
Hi, Thanks for your reply. How can i do this during initialization in the html itself, this is what my html part looks like,
<div id="putawyGroupsId" class="row-control" data-bind="igTextEditor: { value:_putawyGroupsId, inputName:putawyGroupsId, toUpper: true, textMode: 'Text' }">
How can use the setFocus here? If i try to do any event calls inside the block, i get an error saying that the grid is not initialized and you cant call function before that.
That works, thanks a lot!!!
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