|
<ejs-textbox id="textbox" ref="textbox"></ejs-textbox>
this.$refs.textbox.ej2Instances.focusIn();
|
Hi David,
Greetings from Syncfusion support.
We checked your query. The focusIn method can be accessed by using a component reference. Kindly refer the following code.
<ejs-textbox id="textbox" ref="textbox"></ejs-textbox>this.$refs.textbox.ej2Instances.focusIn();
Please find the sample below.
Sample link: https://codesandbox.io/s/textbox-ek4f7
Kindly get back to us for further assistance.
Regards,Sevvandhi N
|
<template>
<div id="app">
<textbox ref="textbox" />
<input type="button" Value="FocusComponent" @click="handleClick" />
</div>
</template>
<script>
import Vue from "vue";
import textbox from "./components/textbox";
export default {
name: "App",
components: { textbox },
methods: {
handleClick: function () {
this.$refs.textbox.$refs.textbox.ej2Instances.focusIn();
},
},
};
</script>
|
Hi David,
We checked your query. The cause of the reported issue is that we can't use child component refs to call the focusIn method directly. We can call the focusIn method on the parent component's ref from the child component's ref. Kindly refer the following code.
[App.vue]
<template><div id="app"><textbox ref="textbox" /><input type="button" Value="FocusComponent" @click="handleClick" /></div></template><script>import Vue from "vue";import textbox from "./components/textbox";export default {name: "App",components: { textbox },methods: {handleClick: function () {this.$refs.textbox.$refs.textbox.ej2Instances.focusIn();},},};</script>
Please find the sample below.
Kindly get back to us for further assistance.
Regards,Sevvandhi N