How to compile html string appended with javascript to vue domHow to validate an email address in JavaScript?How do JavaScript closures work?How do I remove a property from a JavaScript object?How do you get a timestamp in JavaScript?How to append something to an array?How do I include a JavaScript file in another JavaScript file?How do I make the first letter of a string uppercase in JavaScript?How to replace all occurrences of a string in JavaScriptHow to check whether a string contains a substring in JavaScript?How do I remove a particular element from an array in JavaScript?

Could the terminal length of components like resistors be reduced?

Contradiction proof for inequality of P and NP?

Why was the Spitfire's elliptical wing almost uncopied by other aircraft of World War 2?

On The Origin of Dissonant Chords

"You've called the wrong number" or "You called the wrong number"

Why does nature favour the Laplacian?

Apparently, my CLR assembly function is causing deadlocks?

Is there a way to generate a list of distinct numbers such that no two subsets ever have an equal sum?

Like totally amazing interchangeable sister outfits II: The Revenge

Did the BCPL programming language support floats?

Check if a string is entirely made of the same substring

Are there physical dangers to preparing a prepared piano?

Don’t seats that recline flat defeat the purpose of having seatbelts?

'regex' and 'name' directives in find

bldc motor, esc and battery draw, nominal vs peak

Checks user level and limit the data before saving it to mongoDB

How to fry ground beef so it is well-browned

Function pointer with named arguments?

'It addicted me, with one taste.' Can 'addict' be used transitively?

Is there any official lore on the Far Realm?

Which big number is bigger?

How to not starve gigantic beasts

Why does Mind Blank stop the Feeblemind spell?

Multiple options vs single option UI



How to compile html string appended with javascript to vue dom


How to validate an email address in JavaScript?How do JavaScript closures work?How do I remove a property from a JavaScript object?How do you get a timestamp in JavaScript?How to append something to an array?How do I include a JavaScript file in another JavaScript file?How do I make the first letter of a string uppercase in JavaScript?How to replace all occurrences of a string in JavaScriptHow to check whether a string contains a substring in JavaScript?How do I remove a particular element from an array in JavaScript?






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








0















I have a datatables component in my Vuejs app that uses ajax to load data and i want to add buttons to rows and the buttons should be able to call methods from my vue instance.



The button is in the form of a string like so



name:'Action', render(a, b, row) 
return `<a @click="showmore($row.id)">View More</a>`;



i've search every website for a solution and no one seems to have this same issue



Any help would be greatly appreciated










share|improve this question






















  • Why write code as string and then parse it? Can't you prefer write smarts components with the features offered by the framework. For example you can dispatch an action dynamically if setting the action name a component prop. Or you can instantiate different kind of component by using the v-bind:is functionnallity

    – Slim
    Mar 22 at 17:41











  • You can probably use some usage of v-html but that is NOT how you should be going about this. you should use div(v-for="row in rows") and then <a @click="showmore(row.id)>View More</a> will work perfectly fine (in your vue template, given that data:rows:[id:'something1',id:'something2'] be aware that if you need to set a new array element property value you need to use Vue.set

    – Cody G.
    Mar 22 at 18:09












  • Hi Tony. As you may have gathered from the other comments, the reason you can't find a solution is that the approach you propose is wrong. You should define the buttons in your template, not append them via JavaScript. If you don't want the buttons to be visible until the ajax response is available, simply hide them with v-if or v-show.

    – Stephen Thomas
    Mar 22 at 19:10











  • thanks for your replies but look at it this way... the part of the app where i want to add the string is part of another plugin that isn't connected to vue at all..

    – Tony Okoro
    Mar 25 at 8:43












  • I'm using datatables.js to create tables and i'm trying to add buttons to the table rows... so i can't exactly use v-if or v-show to hide or show it because the plugin will create the button from the string

    – Tony Okoro
    Mar 25 at 8:46

















0















I have a datatables component in my Vuejs app that uses ajax to load data and i want to add buttons to rows and the buttons should be able to call methods from my vue instance.



The button is in the form of a string like so



name:'Action', render(a, b, row) 
return `<a @click="showmore($row.id)">View More</a>`;



i've search every website for a solution and no one seems to have this same issue



Any help would be greatly appreciated










share|improve this question






















  • Why write code as string and then parse it? Can't you prefer write smarts components with the features offered by the framework. For example you can dispatch an action dynamically if setting the action name a component prop. Or you can instantiate different kind of component by using the v-bind:is functionnallity

    – Slim
    Mar 22 at 17:41











  • You can probably use some usage of v-html but that is NOT how you should be going about this. you should use div(v-for="row in rows") and then <a @click="showmore(row.id)>View More</a> will work perfectly fine (in your vue template, given that data:rows:[id:'something1',id:'something2'] be aware that if you need to set a new array element property value you need to use Vue.set

    – Cody G.
    Mar 22 at 18:09












  • Hi Tony. As you may have gathered from the other comments, the reason you can't find a solution is that the approach you propose is wrong. You should define the buttons in your template, not append them via JavaScript. If you don't want the buttons to be visible until the ajax response is available, simply hide them with v-if or v-show.

    – Stephen Thomas
    Mar 22 at 19:10











  • thanks for your replies but look at it this way... the part of the app where i want to add the string is part of another plugin that isn't connected to vue at all..

    – Tony Okoro
    Mar 25 at 8:43












  • I'm using datatables.js to create tables and i'm trying to add buttons to the table rows... so i can't exactly use v-if or v-show to hide or show it because the plugin will create the button from the string

    – Tony Okoro
    Mar 25 at 8:46













0












0








0








I have a datatables component in my Vuejs app that uses ajax to load data and i want to add buttons to rows and the buttons should be able to call methods from my vue instance.



The button is in the form of a string like so



name:'Action', render(a, b, row) 
return `<a @click="showmore($row.id)">View More</a>`;



i've search every website for a solution and no one seems to have this same issue



Any help would be greatly appreciated










share|improve this question














I have a datatables component in my Vuejs app that uses ajax to load data and i want to add buttons to rows and the buttons should be able to call methods from my vue instance.



The button is in the form of a string like so



name:'Action', render(a, b, row) 
return `<a @click="showmore($row.id)">View More</a>`;



i've search every website for a solution and no one seems to have this same issue



Any help would be greatly appreciated







javascript jquery vue.js datatables






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Mar 22 at 17:31









Tony OkoroTony Okoro

1




1












  • Why write code as string and then parse it? Can't you prefer write smarts components with the features offered by the framework. For example you can dispatch an action dynamically if setting the action name a component prop. Or you can instantiate different kind of component by using the v-bind:is functionnallity

    – Slim
    Mar 22 at 17:41











  • You can probably use some usage of v-html but that is NOT how you should be going about this. you should use div(v-for="row in rows") and then <a @click="showmore(row.id)>View More</a> will work perfectly fine (in your vue template, given that data:rows:[id:'something1',id:'something2'] be aware that if you need to set a new array element property value you need to use Vue.set

    – Cody G.
    Mar 22 at 18:09












  • Hi Tony. As you may have gathered from the other comments, the reason you can't find a solution is that the approach you propose is wrong. You should define the buttons in your template, not append them via JavaScript. If you don't want the buttons to be visible until the ajax response is available, simply hide them with v-if or v-show.

    – Stephen Thomas
    Mar 22 at 19:10











  • thanks for your replies but look at it this way... the part of the app where i want to add the string is part of another plugin that isn't connected to vue at all..

    – Tony Okoro
    Mar 25 at 8:43












  • I'm using datatables.js to create tables and i'm trying to add buttons to the table rows... so i can't exactly use v-if or v-show to hide or show it because the plugin will create the button from the string

    – Tony Okoro
    Mar 25 at 8:46

















  • Why write code as string and then parse it? Can't you prefer write smarts components with the features offered by the framework. For example you can dispatch an action dynamically if setting the action name a component prop. Or you can instantiate different kind of component by using the v-bind:is functionnallity

    – Slim
    Mar 22 at 17:41











  • You can probably use some usage of v-html but that is NOT how you should be going about this. you should use div(v-for="row in rows") and then <a @click="showmore(row.id)>View More</a> will work perfectly fine (in your vue template, given that data:rows:[id:'something1',id:'something2'] be aware that if you need to set a new array element property value you need to use Vue.set

    – Cody G.
    Mar 22 at 18:09












  • Hi Tony. As you may have gathered from the other comments, the reason you can't find a solution is that the approach you propose is wrong. You should define the buttons in your template, not append them via JavaScript. If you don't want the buttons to be visible until the ajax response is available, simply hide them with v-if or v-show.

    – Stephen Thomas
    Mar 22 at 19:10











  • thanks for your replies but look at it this way... the part of the app where i want to add the string is part of another plugin that isn't connected to vue at all..

    – Tony Okoro
    Mar 25 at 8:43












  • I'm using datatables.js to create tables and i'm trying to add buttons to the table rows... so i can't exactly use v-if or v-show to hide or show it because the plugin will create the button from the string

    – Tony Okoro
    Mar 25 at 8:46
















Why write code as string and then parse it? Can't you prefer write smarts components with the features offered by the framework. For example you can dispatch an action dynamically if setting the action name a component prop. Or you can instantiate different kind of component by using the v-bind:is functionnallity

– Slim
Mar 22 at 17:41





Why write code as string and then parse it? Can't you prefer write smarts components with the features offered by the framework. For example you can dispatch an action dynamically if setting the action name a component prop. Or you can instantiate different kind of component by using the v-bind:is functionnallity

– Slim
Mar 22 at 17:41













You can probably use some usage of v-html but that is NOT how you should be going about this. you should use div(v-for="row in rows") and then <a @click="showmore(row.id)>View More</a> will work perfectly fine (in your vue template, given that data:rows:[id:'something1',id:'something2'] be aware that if you need to set a new array element property value you need to use Vue.set

– Cody G.
Mar 22 at 18:09






You can probably use some usage of v-html but that is NOT how you should be going about this. you should use div(v-for="row in rows") and then <a @click="showmore(row.id)>View More</a> will work perfectly fine (in your vue template, given that data:rows:[id:'something1',id:'something2'] be aware that if you need to set a new array element property value you need to use Vue.set

– Cody G.
Mar 22 at 18:09














Hi Tony. As you may have gathered from the other comments, the reason you can't find a solution is that the approach you propose is wrong. You should define the buttons in your template, not append them via JavaScript. If you don't want the buttons to be visible until the ajax response is available, simply hide them with v-if or v-show.

– Stephen Thomas
Mar 22 at 19:10





Hi Tony. As you may have gathered from the other comments, the reason you can't find a solution is that the approach you propose is wrong. You should define the buttons in your template, not append them via JavaScript. If you don't want the buttons to be visible until the ajax response is available, simply hide them with v-if or v-show.

– Stephen Thomas
Mar 22 at 19:10













thanks for your replies but look at it this way... the part of the app where i want to add the string is part of another plugin that isn't connected to vue at all..

– Tony Okoro
Mar 25 at 8:43






thanks for your replies but look at it this way... the part of the app where i want to add the string is part of another plugin that isn't connected to vue at all..

– Tony Okoro
Mar 25 at 8:43














I'm using datatables.js to create tables and i'm trying to add buttons to the table rows... so i can't exactly use v-if or v-show to hide or show it because the plugin will create the button from the string

– Tony Okoro
Mar 25 at 8:46





I'm using datatables.js to create tables and i'm trying to add buttons to the table rows... so i can't exactly use v-if or v-show to hide or show it because the plugin will create the button from the string

– Tony Okoro
Mar 25 at 8:46












0






active

oldest

votes












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%2f55304965%2fhow-to-compile-html-string-appended-with-javascript-to-vue-dom%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes















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%2f55304965%2fhow-to-compile-html-string-appended-with-javascript-to-vue-dom%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







Popular posts from this blog

SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

용인 삼성생명 블루밍스 목차 통계 역대 감독 선수단 응원단 경기장 같이 보기 외부 링크 둘러보기 메뉴samsungblueminx.comeh선수 명단용인 삼성생명 블루밍스용인 삼성생명 블루밍스ehsamsungblueminx.comeheheheh

155 수학 과학 기타 둘러보기 메뉴eh추가해eh문서를 완성해