Two way data binding not working on Kendo UI The 2019 Stack Overflow Developer Survey Results Are InHow do JavaScript closures work?What is the most efficient way to deep clone an object in JavaScript?How can I merge properties of two JavaScript objects dynamically?Event binding on dynamically created elements?Compare two dates with JavaScriptHow does JavaScript .prototype work?Convert form data to JavaScript object with jQueryWhat is the best way to detect a mobile device in jQuery?Generate random number between two numbers in JavaScriptHow does data binding work in AngularJS?
Output the Arecibo Message
What do hard-Brexiteers want with respect to the Irish border?
How to answer pointed "are you quitting" questioning when I don't want them to suspect
Why Did Howard Stark Use All The Vibranium They Had On A Prototype Shield?
If a poisoned arrow's piercing damage is reduced to 0, do you still get poisoned?
Inversion Puzzle
Falsification in Math vs Science
Lethal sonic weapons
What do the Banks children have against barley water?
How was Skylab's orbit inclination chosen?
On the insanity of kings as an argument against Monarchy
What are the motivations for publishing new editions of an existing textbook, beyond new discoveries in a field?
Why is Grand Jury testimony secret?
What tool would a Roman-age civilization have to grind silver and other metals into dust?
Does duplicating a spell with Wish count as casting that spell?
Carnot-Caratheodory metric
Realistic Alternatives to Dust: What Else Could Feed a Plankton Bloom?
Patience, young "Padovan"
JSON.serialize: is it possible to suppress null values of a map?
Springs with some finite mass
What is the meaning of Triage in Cybersec world?
Geography at the pixel level
Why could you hear an Amstrad CPC working?
Pristine Bit Checking
Two way data binding not working on Kendo UI
The 2019 Stack Overflow Developer Survey Results Are InHow do JavaScript closures work?What is the most efficient way to deep clone an object in JavaScript?How can I merge properties of two JavaScript objects dynamically?Event binding on dynamically created elements?Compare two dates with JavaScriptHow does JavaScript .prototype work?Convert form data to JavaScript object with jQueryWhat is the best way to detect a mobile device in jQuery?Generate random number between two numbers in JavaScriptHow does data binding work in AngularJS?
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
I have a kendo-dropdownlist component that gets it's data from an API call. I had implemented this using the kendo-datasource component and everything worked fine.
But I now have multiple kendo-dropdownlist components and instead of making an API call for every kendo-dropdownlist component, I am supposed to make only one API call and all the kendo-dropdownlist components should get it's data from the same JSON response. This kendo-dropdownlist is bound to a property called "currentData".
So what I am doing now is that I am declaring a kendo-dropdownlist component but not giving it any data-source-ref. Instead I am setting it's data-source attribute to a local data property called "source" which is an array of JSON.
Then in the mount life-cycle hook, I am making an API call and setting the response to the "source" data property. After this, the dropdown-items get populated in the kendo-dropdownlist but the "currentData" is not selected.
Component template:
<kendo-dropdownlist
v-model="currentData"
:data-source="source.filter(s => s.type == 'something')"
data-text-field="name"
data-value-field="Id"
></kendo-dropdownlist>
Component script:
export default
name: "SomeComponent",
props:
prop1: String
,
data()
return
currentData: this.prop1
source: []
;
,
mounted: async function()
await this.setDataSource();
,
methods:
async setDataSource()
const formDTO = await SERVICE.getDataSource();
this.source= formDTO.stakeholders;
;
I can confirm that one of the objects in the sources array has it's Id property equal to this.prop1 .
javascript vue.js kendo-ui
add a comment |
I have a kendo-dropdownlist component that gets it's data from an API call. I had implemented this using the kendo-datasource component and everything worked fine.
But I now have multiple kendo-dropdownlist components and instead of making an API call for every kendo-dropdownlist component, I am supposed to make only one API call and all the kendo-dropdownlist components should get it's data from the same JSON response. This kendo-dropdownlist is bound to a property called "currentData".
So what I am doing now is that I am declaring a kendo-dropdownlist component but not giving it any data-source-ref. Instead I am setting it's data-source attribute to a local data property called "source" which is an array of JSON.
Then in the mount life-cycle hook, I am making an API call and setting the response to the "source" data property. After this, the dropdown-items get populated in the kendo-dropdownlist but the "currentData" is not selected.
Component template:
<kendo-dropdownlist
v-model="currentData"
:data-source="source.filter(s => s.type == 'something')"
data-text-field="name"
data-value-field="Id"
></kendo-dropdownlist>
Component script:
export default
name: "SomeComponent",
props:
prop1: String
,
data()
return
currentData: this.prop1
source: []
;
,
mounted: async function()
await this.setDataSource();
,
methods:
async setDataSource()
const formDTO = await SERVICE.getDataSource();
this.source= formDTO.stakeholders;
;
I can confirm that one of the objects in the sources array has it's Id property equal to this.prop1 .
javascript vue.js kendo-ui
Do you also confirm thatsourcearray contains elements oftype == something?
– P3trur0
Mar 11 at 9:38
@P3trur0 yes. I can confirm that.
– ravi kumar
Mar 11 at 9:52
add a comment |
I have a kendo-dropdownlist component that gets it's data from an API call. I had implemented this using the kendo-datasource component and everything worked fine.
But I now have multiple kendo-dropdownlist components and instead of making an API call for every kendo-dropdownlist component, I am supposed to make only one API call and all the kendo-dropdownlist components should get it's data from the same JSON response. This kendo-dropdownlist is bound to a property called "currentData".
So what I am doing now is that I am declaring a kendo-dropdownlist component but not giving it any data-source-ref. Instead I am setting it's data-source attribute to a local data property called "source" which is an array of JSON.
Then in the mount life-cycle hook, I am making an API call and setting the response to the "source" data property. After this, the dropdown-items get populated in the kendo-dropdownlist but the "currentData" is not selected.
Component template:
<kendo-dropdownlist
v-model="currentData"
:data-source="source.filter(s => s.type == 'something')"
data-text-field="name"
data-value-field="Id"
></kendo-dropdownlist>
Component script:
export default
name: "SomeComponent",
props:
prop1: String
,
data()
return
currentData: this.prop1
source: []
;
,
mounted: async function()
await this.setDataSource();
,
methods:
async setDataSource()
const formDTO = await SERVICE.getDataSource();
this.source= formDTO.stakeholders;
;
I can confirm that one of the objects in the sources array has it's Id property equal to this.prop1 .
javascript vue.js kendo-ui
I have a kendo-dropdownlist component that gets it's data from an API call. I had implemented this using the kendo-datasource component and everything worked fine.
But I now have multiple kendo-dropdownlist components and instead of making an API call for every kendo-dropdownlist component, I am supposed to make only one API call and all the kendo-dropdownlist components should get it's data from the same JSON response. This kendo-dropdownlist is bound to a property called "currentData".
So what I am doing now is that I am declaring a kendo-dropdownlist component but not giving it any data-source-ref. Instead I am setting it's data-source attribute to a local data property called "source" which is an array of JSON.
Then in the mount life-cycle hook, I am making an API call and setting the response to the "source" data property. After this, the dropdown-items get populated in the kendo-dropdownlist but the "currentData" is not selected.
Component template:
<kendo-dropdownlist
v-model="currentData"
:data-source="source.filter(s => s.type == 'something')"
data-text-field="name"
data-value-field="Id"
></kendo-dropdownlist>
Component script:
export default
name: "SomeComponent",
props:
prop1: String
,
data()
return
currentData: this.prop1
source: []
;
,
mounted: async function()
await this.setDataSource();
,
methods:
async setDataSource()
const formDTO = await SERVICE.getDataSource();
this.source= formDTO.stakeholders;
;
I can confirm that one of the objects in the sources array has it's Id property equal to this.prop1 .
javascript vue.js kendo-ui
javascript vue.js kendo-ui
edited Mar 12 at 16:58
ravi kumar
asked Mar 8 at 8:27
ravi kumarravi kumar
465416
465416
Do you also confirm thatsourcearray contains elements oftype == something?
– P3trur0
Mar 11 at 9:38
@P3trur0 yes. I can confirm that.
– ravi kumar
Mar 11 at 9:52
add a comment |
Do you also confirm thatsourcearray contains elements oftype == something?
– P3trur0
Mar 11 at 9:38
@P3trur0 yes. I can confirm that.
– ravi kumar
Mar 11 at 9:52
Do you also confirm that
source array contains elements of type == something?– P3trur0
Mar 11 at 9:38
Do you also confirm that
source array contains elements of type == something?– P3trur0
Mar 11 at 9:38
@P3trur0 yes. I can confirm that.
– ravi kumar
Mar 11 at 9:52
@P3trur0 yes. I can confirm that.
– ravi kumar
Mar 11 at 9:52
add a comment |
1 Answer
1
active
oldest
votes
I can see in your mounted lifecycle hook, you have called setDataSource function. but you missed the reference to that function.
It should be called if you use
await this.setDataSource()
instead of
await setDataSource()
You can click on the any of the data and corresponding data is visible under <p></p> tag.
UPDATED StackBlitz Link:
Here is the working Stackblitz
Hope this helps!
1
This is it, if it's referred correctly, it works fine. Just checked myself :)
– Towkir Ahmed
Mar 12 at 8:23
@ravi Please accept the answer, If it helps.
– varit05
Mar 12 at 11:10
my bad. My actual code containsthisbut I forgot to put it here while copying. But you example also doesn't solve the problem. Like I mentioned in the question, I am able to set the data-source, It is the binding that is not working
– ravi kumar
Mar 12 at 17:02
With the stackBlitz, you can also see that the data are populating from API.
– varit05
Mar 12 at 17:03
Data are coming as per the selected data from Dropdownlist.
– varit05
Mar 12 at 17:20
|
show 1 more comment
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55059306%2ftwo-way-data-binding-not-working-on-kendo-ui%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
I can see in your mounted lifecycle hook, you have called setDataSource function. but you missed the reference to that function.
It should be called if you use
await this.setDataSource()
instead of
await setDataSource()
You can click on the any of the data and corresponding data is visible under <p></p> tag.
UPDATED StackBlitz Link:
Here is the working Stackblitz
Hope this helps!
1
This is it, if it's referred correctly, it works fine. Just checked myself :)
– Towkir Ahmed
Mar 12 at 8:23
@ravi Please accept the answer, If it helps.
– varit05
Mar 12 at 11:10
my bad. My actual code containsthisbut I forgot to put it here while copying. But you example also doesn't solve the problem. Like I mentioned in the question, I am able to set the data-source, It is the binding that is not working
– ravi kumar
Mar 12 at 17:02
With the stackBlitz, you can also see that the data are populating from API.
– varit05
Mar 12 at 17:03
Data are coming as per the selected data from Dropdownlist.
– varit05
Mar 12 at 17:20
|
show 1 more comment
I can see in your mounted lifecycle hook, you have called setDataSource function. but you missed the reference to that function.
It should be called if you use
await this.setDataSource()
instead of
await setDataSource()
You can click on the any of the data and corresponding data is visible under <p></p> tag.
UPDATED StackBlitz Link:
Here is the working Stackblitz
Hope this helps!
1
This is it, if it's referred correctly, it works fine. Just checked myself :)
– Towkir Ahmed
Mar 12 at 8:23
@ravi Please accept the answer, If it helps.
– varit05
Mar 12 at 11:10
my bad. My actual code containsthisbut I forgot to put it here while copying. But you example also doesn't solve the problem. Like I mentioned in the question, I am able to set the data-source, It is the binding that is not working
– ravi kumar
Mar 12 at 17:02
With the stackBlitz, you can also see that the data are populating from API.
– varit05
Mar 12 at 17:03
Data are coming as per the selected data from Dropdownlist.
– varit05
Mar 12 at 17:20
|
show 1 more comment
I can see in your mounted lifecycle hook, you have called setDataSource function. but you missed the reference to that function.
It should be called if you use
await this.setDataSource()
instead of
await setDataSource()
You can click on the any of the data and corresponding data is visible under <p></p> tag.
UPDATED StackBlitz Link:
Here is the working Stackblitz
Hope this helps!
I can see in your mounted lifecycle hook, you have called setDataSource function. but you missed the reference to that function.
It should be called if you use
await this.setDataSource()
instead of
await setDataSource()
You can click on the any of the data and corresponding data is visible under <p></p> tag.
UPDATED StackBlitz Link:
Here is the working Stackblitz
Hope this helps!
edited Mar 12 at 17:17
answered Mar 12 at 8:22
varit05varit05
2,3501918
2,3501918
1
This is it, if it's referred correctly, it works fine. Just checked myself :)
– Towkir Ahmed
Mar 12 at 8:23
@ravi Please accept the answer, If it helps.
– varit05
Mar 12 at 11:10
my bad. My actual code containsthisbut I forgot to put it here while copying. But you example also doesn't solve the problem. Like I mentioned in the question, I am able to set the data-source, It is the binding that is not working
– ravi kumar
Mar 12 at 17:02
With the stackBlitz, you can also see that the data are populating from API.
– varit05
Mar 12 at 17:03
Data are coming as per the selected data from Dropdownlist.
– varit05
Mar 12 at 17:20
|
show 1 more comment
1
This is it, if it's referred correctly, it works fine. Just checked myself :)
– Towkir Ahmed
Mar 12 at 8:23
@ravi Please accept the answer, If it helps.
– varit05
Mar 12 at 11:10
my bad. My actual code containsthisbut I forgot to put it here while copying. But you example also doesn't solve the problem. Like I mentioned in the question, I am able to set the data-source, It is the binding that is not working
– ravi kumar
Mar 12 at 17:02
With the stackBlitz, you can also see that the data are populating from API.
– varit05
Mar 12 at 17:03
Data are coming as per the selected data from Dropdownlist.
– varit05
Mar 12 at 17:20
1
1
This is it, if it's referred correctly, it works fine. Just checked myself :)
– Towkir Ahmed
Mar 12 at 8:23
This is it, if it's referred correctly, it works fine. Just checked myself :)
– Towkir Ahmed
Mar 12 at 8:23
@ravi Please accept the answer, If it helps.
– varit05
Mar 12 at 11:10
@ravi Please accept the answer, If it helps.
– varit05
Mar 12 at 11:10
my bad. My actual code contains
this but I forgot to put it here while copying. But you example also doesn't solve the problem. Like I mentioned in the question, I am able to set the data-source, It is the binding that is not working– ravi kumar
Mar 12 at 17:02
my bad. My actual code contains
this but I forgot to put it here while copying. But you example also doesn't solve the problem. Like I mentioned in the question, I am able to set the data-source, It is the binding that is not working– ravi kumar
Mar 12 at 17:02
With the stackBlitz, you can also see that the data are populating from API.
– varit05
Mar 12 at 17:03
With the stackBlitz, you can also see that the data are populating from API.
– varit05
Mar 12 at 17:03
Data are coming as per the selected data from Dropdownlist.
– varit05
Mar 12 at 17:20
Data are coming as per the selected data from Dropdownlist.
– varit05
Mar 12 at 17:20
|
show 1 more comment
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55059306%2ftwo-way-data-binding-not-working-on-kendo-ui%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Do you also confirm that
sourcearray contains elements oftype == something?– P3trur0
Mar 11 at 9:38
@P3trur0 yes. I can confirm that.
– ravi kumar
Mar 11 at 9:52