I want to called id into sibling component in the axios get method and display the output data in vue client...

Multi tool use
Multi tool use












-1















 created () {
let self = this;

// after this point, `self` will reference the Vue instance even in callbacks
this.$root.$on('eventing', tableDataId => {
axios.get('http://192.168.2.35:8000/api/v1/post_bi' + '/' + tableDataId)
.then((response) => {
// setting `self` to `this` here doesn't make sense because `this`
// is not refering to the Vue instance in this callback
self.tableData = response.data;
console.log(self.tableData)
})
.catch((error) => {
console.log(error)
})
})


I wrote this code but the output of table data does not show in v client table.










share|improve this question

























  • Why are you accessing root? What are you trying to achieve?

    – Frank
    Jan 3 at 10:19











  • i want to send id(id get from another component ) to axios method and get data into v-client table , as i am getting data on console but its still not populate on v-client table .

    – ShrJoshi
    Jan 4 at 13:27
















-1















 created () {
let self = this;

// after this point, `self` will reference the Vue instance even in callbacks
this.$root.$on('eventing', tableDataId => {
axios.get('http://192.168.2.35:8000/api/v1/post_bi' + '/' + tableDataId)
.then((response) => {
// setting `self` to `this` here doesn't make sense because `this`
// is not refering to the Vue instance in this callback
self.tableData = response.data;
console.log(self.tableData)
})
.catch((error) => {
console.log(error)
})
})


I wrote this code but the output of table data does not show in v client table.










share|improve this question

























  • Why are you accessing root? What are you trying to achieve?

    – Frank
    Jan 3 at 10:19











  • i want to send id(id get from another component ) to axios method and get data into v-client table , as i am getting data on console but its still not populate on v-client table .

    – ShrJoshi
    Jan 4 at 13:27














-1












-1








-1








 created () {
let self = this;

// after this point, `self` will reference the Vue instance even in callbacks
this.$root.$on('eventing', tableDataId => {
axios.get('http://192.168.2.35:8000/api/v1/post_bi' + '/' + tableDataId)
.then((response) => {
// setting `self` to `this` here doesn't make sense because `this`
// is not refering to the Vue instance in this callback
self.tableData = response.data;
console.log(self.tableData)
})
.catch((error) => {
console.log(error)
})
})


I wrote this code but the output of table data does not show in v client table.










share|improve this question
















 created () {
let self = this;

// after this point, `self` will reference the Vue instance even in callbacks
this.$root.$on('eventing', tableDataId => {
axios.get('http://192.168.2.35:8000/api/v1/post_bi' + '/' + tableDataId)
.then((response) => {
// setting `self` to `this` here doesn't make sense because `this`
// is not refering to the Vue instance in this callback
self.tableData = response.data;
console.log(self.tableData)
})
.catch((error) => {
console.log(error)
})
})


I wrote this code but the output of table data does not show in v client table.







vue.js






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jan 3 at 11:08









Frank

5881625




5881625










asked Jan 3 at 9:15









ShrJoshiShrJoshi

42




42













  • Why are you accessing root? What are you trying to achieve?

    – Frank
    Jan 3 at 10:19











  • i want to send id(id get from another component ) to axios method and get data into v-client table , as i am getting data on console but its still not populate on v-client table .

    – ShrJoshi
    Jan 4 at 13:27



















  • Why are you accessing root? What are you trying to achieve?

    – Frank
    Jan 3 at 10:19











  • i want to send id(id get from another component ) to axios method and get data into v-client table , as i am getting data on console but its still not populate on v-client table .

    – ShrJoshi
    Jan 4 at 13:27

















Why are you accessing root? What are you trying to achieve?

– Frank
Jan 3 at 10:19





Why are you accessing root? What are you trying to achieve?

– Frank
Jan 3 at 10:19













i want to send id(id get from another component ) to axios method and get data into v-client table , as i am getting data on console but its still not populate on v-client table .

– ShrJoshi
Jan 4 at 13:27





i want to send id(id get from another component ) to axios method and get data into v-client table , as i am getting data on console but its still not populate on v-client table .

– ShrJoshi
Jan 4 at 13:27












1 Answer
1






active

oldest

votes


















0














Try this



created () {
axios.get('http://192.168.2.35:8000/api/v1/post_bi/'+ this.tableDataId)
.then((response) => {
this.tableData = response.data;
})
.catch((error) => {
console.log(error)
})
})


Assuming you have declared tableData and tableDataId in your component like this



data() {
return {
tableData: '',
tableDataId: '',
}
}





share|improve this answer
























  • here is tableDataId is given from another component in that component i declare this- this.$root.$emit('eventing', tableDataId); and i want to access here- this.$root.$once('eventing', tableDataId=> { // console.log(tableDataId); this.id=tableDataId; axios.get('192.168.2.35:8000/api/v1/post_bi/'+this.id) .then((response) => { this.tableData = response.data; }) }) tableData display on console log but not view in table format.

    – ShrJoshi
    Jan 5 at 7:37













  • vuejs.org/v2/guide/…

    – Frank
    Jan 5 at 11:34











  • I am using this in first component this.$nextTick(() => { this.$root.$emit('eventing', tableDataId); }) and this in another component this.$root.$once('eventing', tableDataId=> { // console.log(tableDataId); this.id = tableDataId; })

    – ShrJoshi
    Feb 5 at 6:52











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
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54019273%2fi-want-to-called-id-into-sibling-component-in-the-axios-get-method-and-display-t%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









0














Try this



created () {
axios.get('http://192.168.2.35:8000/api/v1/post_bi/'+ this.tableDataId)
.then((response) => {
this.tableData = response.data;
})
.catch((error) => {
console.log(error)
})
})


Assuming you have declared tableData and tableDataId in your component like this



data() {
return {
tableData: '',
tableDataId: '',
}
}





share|improve this answer
























  • here is tableDataId is given from another component in that component i declare this- this.$root.$emit('eventing', tableDataId); and i want to access here- this.$root.$once('eventing', tableDataId=> { // console.log(tableDataId); this.id=tableDataId; axios.get('192.168.2.35:8000/api/v1/post_bi/'+this.id) .then((response) => { this.tableData = response.data; }) }) tableData display on console log but not view in table format.

    – ShrJoshi
    Jan 5 at 7:37













  • vuejs.org/v2/guide/…

    – Frank
    Jan 5 at 11:34











  • I am using this in first component this.$nextTick(() => { this.$root.$emit('eventing', tableDataId); }) and this in another component this.$root.$once('eventing', tableDataId=> { // console.log(tableDataId); this.id = tableDataId; })

    – ShrJoshi
    Feb 5 at 6:52
















0














Try this



created () {
axios.get('http://192.168.2.35:8000/api/v1/post_bi/'+ this.tableDataId)
.then((response) => {
this.tableData = response.data;
})
.catch((error) => {
console.log(error)
})
})


Assuming you have declared tableData and tableDataId in your component like this



data() {
return {
tableData: '',
tableDataId: '',
}
}





share|improve this answer
























  • here is tableDataId is given from another component in that component i declare this- this.$root.$emit('eventing', tableDataId); and i want to access here- this.$root.$once('eventing', tableDataId=> { // console.log(tableDataId); this.id=tableDataId; axios.get('192.168.2.35:8000/api/v1/post_bi/'+this.id) .then((response) => { this.tableData = response.data; }) }) tableData display on console log but not view in table format.

    – ShrJoshi
    Jan 5 at 7:37













  • vuejs.org/v2/guide/…

    – Frank
    Jan 5 at 11:34











  • I am using this in first component this.$nextTick(() => { this.$root.$emit('eventing', tableDataId); }) and this in another component this.$root.$once('eventing', tableDataId=> { // console.log(tableDataId); this.id = tableDataId; })

    – ShrJoshi
    Feb 5 at 6:52














0












0








0







Try this



created () {
axios.get('http://192.168.2.35:8000/api/v1/post_bi/'+ this.tableDataId)
.then((response) => {
this.tableData = response.data;
})
.catch((error) => {
console.log(error)
})
})


Assuming you have declared tableData and tableDataId in your component like this



data() {
return {
tableData: '',
tableDataId: '',
}
}





share|improve this answer













Try this



created () {
axios.get('http://192.168.2.35:8000/api/v1/post_bi/'+ this.tableDataId)
.then((response) => {
this.tableData = response.data;
})
.catch((error) => {
console.log(error)
})
})


Assuming you have declared tableData and tableDataId in your component like this



data() {
return {
tableData: '',
tableDataId: '',
}
}






share|improve this answer












share|improve this answer



share|improve this answer










answered Jan 4 at 13:31









FrankFrank

5881625




5881625













  • here is tableDataId is given from another component in that component i declare this- this.$root.$emit('eventing', tableDataId); and i want to access here- this.$root.$once('eventing', tableDataId=> { // console.log(tableDataId); this.id=tableDataId; axios.get('192.168.2.35:8000/api/v1/post_bi/'+this.id) .then((response) => { this.tableData = response.data; }) }) tableData display on console log but not view in table format.

    – ShrJoshi
    Jan 5 at 7:37













  • vuejs.org/v2/guide/…

    – Frank
    Jan 5 at 11:34











  • I am using this in first component this.$nextTick(() => { this.$root.$emit('eventing', tableDataId); }) and this in another component this.$root.$once('eventing', tableDataId=> { // console.log(tableDataId); this.id = tableDataId; })

    – ShrJoshi
    Feb 5 at 6:52



















  • here is tableDataId is given from another component in that component i declare this- this.$root.$emit('eventing', tableDataId); and i want to access here- this.$root.$once('eventing', tableDataId=> { // console.log(tableDataId); this.id=tableDataId; axios.get('192.168.2.35:8000/api/v1/post_bi/'+this.id) .then((response) => { this.tableData = response.data; }) }) tableData display on console log but not view in table format.

    – ShrJoshi
    Jan 5 at 7:37













  • vuejs.org/v2/guide/…

    – Frank
    Jan 5 at 11:34











  • I am using this in first component this.$nextTick(() => { this.$root.$emit('eventing', tableDataId); }) and this in another component this.$root.$once('eventing', tableDataId=> { // console.log(tableDataId); this.id = tableDataId; })

    – ShrJoshi
    Feb 5 at 6:52

















here is tableDataId is given from another component in that component i declare this- this.$root.$emit('eventing', tableDataId); and i want to access here- this.$root.$once('eventing', tableDataId=> { // console.log(tableDataId); this.id=tableDataId; axios.get('192.168.2.35:8000/api/v1/post_bi/'+this.id) .then((response) => { this.tableData = response.data; }) }) tableData display on console log but not view in table format.

– ShrJoshi
Jan 5 at 7:37







here is tableDataId is given from another component in that component i declare this- this.$root.$emit('eventing', tableDataId); and i want to access here- this.$root.$once('eventing', tableDataId=> { // console.log(tableDataId); this.id=tableDataId; axios.get('192.168.2.35:8000/api/v1/post_bi/'+this.id) .then((response) => { this.tableData = response.data; }) }) tableData display on console log but not view in table format.

– ShrJoshi
Jan 5 at 7:37















vuejs.org/v2/guide/…

– Frank
Jan 5 at 11:34





vuejs.org/v2/guide/…

– Frank
Jan 5 at 11:34













I am using this in first component this.$nextTick(() => { this.$root.$emit('eventing', tableDataId); }) and this in another component this.$root.$once('eventing', tableDataId=> { // console.log(tableDataId); this.id = tableDataId; })

– ShrJoshi
Feb 5 at 6:52





I am using this in first component this.$nextTick(() => { this.$root.$emit('eventing', tableDataId); }) and this in another component this.$root.$once('eventing', tableDataId=> { // console.log(tableDataId); this.id = tableDataId; })

– ShrJoshi
Feb 5 at 6:52




















draft saved

draft discarded




















































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.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54019273%2fi-want-to-called-id-into-sibling-component-in-the-axios-get-method-and-display-t%23new-answer', 'question_page');
}
);

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







88d2bJtS,Ae,waAG73URUR,Ysspaq YLQVvV cyHy2QYSEv73CpZ tWHgxyFQUuUJ2InDr2ATbzeEEP1WD4jc
3nh4vl KnpnX3OPj7T0G,OeG2zvKIg,bsP1d p7ooKp5EOuCwfLear sOuRs6lN DwzUw35 TiOk

Popular posts from this blog

Monofisismo

Angular Downloading a file using contenturl with Basic Authentication

Olmecas