Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi all,
I currently have a text and image object embedded in my mashup.
My goal is to retrieve the text value from the text and image object and insert it into a prompt box so that a user can change the text and feed it back into the Qlik object.
This post is highly relevant but is unfortunately directed towards Qlik View instead of Qlik Sense.
GetText from TextBox via Javascript API
Any hints/tips will be highly appreciated!
Thanks in advance.
Cheers,
Joel
Hi Joel,
the best way to get the data is to use the model. Code snippet for this:
app.getObject('QV01','xCfgTh').then(function(model){
//data will be in model.layout
//if you want to be notified when data changes, you can use the Validated notification:
model.Validated.bind(function(){
//updated data in this.layout
});
});
To actually modify the text you would use the applyPatches(patches, softPatch) method, also available on the model object. The softpatch parameters allows you to make changes that are only temporary and do not affect other users.
I showed this at Qonnections, and the demo I used then is available at Qlik Branch.
Hope this helps!
Hi Joel,
the best way to get the data is to use the model. Code snippet for this:
app.getObject('QV01','xCfgTh').then(function(model){
//data will be in model.layout
//if you want to be notified when data changes, you can use the Validated notification:
model.Validated.bind(function(){
//updated data in this.layout
});
});
To actually modify the text you would use the applyPatches(patches, softPatch) method, also available on the model object. The softpatch parameters allows you to make changes that are only temporary and do not affect other users.
I showed this at Qonnections, and the demo I used then is available at Qlik Branch.
Hope this helps!
Hi Erik,
Thanks for the help!
I am getting very close as I am able to modify an extension using the applyPatches method. The only problem is that for a text and image object, I am not sure on the value I need to use for the "qPath" component.
Using chrome inspect element, I can see that my text value is being stored under VisualisationObject --> layout --> markdown.
Could you please advise?
Cheers,
Joel
Hi Joel,
Try with '/markdown'. Not that a string value needs to be enclosed in ".
Erik
Please mark the appropriate replies as correct or helpful so our team and other members know that your question has been answered to your satisfaction.
That worked!
Thanks again Erik.