Esta conversa foi bloqueada devido à inatividade. Crie uma nova publicação.
Nível 1
Nível 2
Faça login na Comunidade
Faça logon para exibir todas as medalhas
Esta conversa foi bloqueada devido à inatividade. Crie uma nova publicação.
I have created a multifieldpanel component where the values are getting stored in below json format:
with the name :definitions
{"node1":"hello","node2":"textarea1"}
How can i print the key(node1,node2) and values(hello,textarea1) separately. I am using sightly with JavaScript-use API.
Thanks
Akshita
Solucionado! Ir para a Solução.
Visualizações
respostas
Total de curtidas
Here some sample code:
<ul data-sly-use.listValues="listValues.js" data-sly-list="${ listValues.json }">
<li>${item} ${listValues.json[item]}</li>
</ul>
JS:
use(function () {
var values = String(properties.get("values"));
var json = JSON.parse(values);
return {
json : json
};
});
Visualizações
respostas
Total de curtidas
Here some sample code:
<ul data-sly-use.listValues="listValues.js" data-sly-list="${ listValues.json }">
<li>${item} ${listValues.json[item]}</li>
</ul>
JS:
use(function () {
var values = String(properties.get("values"));
var json = JSON.parse(values);
return {
json : json
};
});
Visualizações
respostas
Total de curtidas
Feike Visser wrote...
Here some sample code:
<ul data-sly-use.listValues="listValues.js" data-sly-list="${ listValues.json }">
<li>${item} ${listValues.json[item]}</li>
</ul>
JS:
use(function () {
var values = String(properties.get("values"));
var json = JSON.parse(values);
return {
json : json
};
});
Hi Feike,
It worked out for the above data. Thanks 🙂
However if i have multiple data as below:
{"node1":"hello","node2":"textarea1"} , {"node1":"bye","node2":"textarea2"}
it is throwing Unexpected token: L error.
Thanks
Akshita
Visualizações
respostas
Total de curtidas
Is this in a String-array?
Visualizações
respostas
Total de curtidas
Feikke please see the attachment.
Visualizações
respostas
Total de curtidas
You need to handle it as an array.
use(function () {
var values = String(properties.get("values"));
var json = JSON.parse("["+values+"]");
return {
json : json
};
});
Visualizações
respostas
Total de curtidas
Feike Visser wrote...
You need to handle it as an array.
use(function () {
var values = String(properties.get("values"));
var json = JSON.parse("["+values+"]");
return {
json : json
};
});
modified js but still the same error.
Visualizações
respostas
Total de curtidas
Are you using 6.2?
Visualizações
respostas
Total de curtidas
Feike Visser wrote...
Are you using 6.2?
Yes
Visualizações
respostas
Total de curtidas
Can you export the content you have? So I can compare the JSON-Strings
Visualizações
respostas
Total de curtidas
Feike Visser wrote...
Can you export the content you have? So I can compare the JSON-Strings
Unable to share the zip file here. giving error.
Visualizações
respostas
Total de curtidas
Visualizações
Curtida
respostas
Visualizações
Curtida
respostas
Visualizações
Curtida
respostas