Page 2 of 4

Get image name when clicked

Posted: Mon Apr 01, 2013 8:09 pm
by leonardo

Tutorialtest


Get image name when clicked

Posted: Mon Apr 01, 2013 8:45 pm
by Maryna Brodina

$(this).text() works because when you add JS on Click event inside the JS function "this" means current element.

When you call Tiggzi('filteredName').text(), Tiggzi('filteredName') references on first found in the document object with dsid="filteredName". In DOM first object with dsid="filteredName" is hidden object used for mapping. For example you can check all label values on page (including hidden) with dsid:

code$('[dsid=filteredName]').each(function(){alert($(this).text());})/code

Could you also clarify what are you trying to achive using codeTiggzi('filteredName').text()/code and why don't you use $(this).text()?


Get image name when clicked

Posted: Mon Apr 01, 2013 9:04 pm
by Maryna Brodina

Not sure I understand what does "isolating the name through the text of the label and image" and "extract the story node from the DOM" mean. Could you tell us expected result after you click on image and/or label Rodrigo Mull for example?


Get image name when clicked

Posted: Mon Apr 01, 2013 11:00 pm
by leonardo

Thanks Marina for your clear explanation. I now understand why codealert($(this).text());/code works directly and codeTiggzi('filteredName').text()/code didn't.

By using codeTiggzi('filteredName').text()/code I wanted to see if there is a Tiggzi function that works like: codealert($(this).text());/code with your explanation, that I got that now.

What I want to do after click on image and/or label of Rodrigo Mull, for example, is to capture or collect the story for Rodrigo, which is stored in the story element (along with its children -- the H1 and P elements). So that I can convert it to HTML and get it displayed in the Panel component of Detail Page. That's what I've been battling.

Essentially, I just want to know how to actually display the story for each clicked name in the Panel component.


Get image name when clicked

Posted: Tue Apr 02, 2013 8:58 am
by Kateryna Grynko

Hi Leonardo,

You can apply HTML code to Panel using the folowing JavaScript code:
codeTiggzi('panelComponentName')&#46;html("<h2>Heading<&#47;h2>");/code


Get image name when clicked

Posted: Tue Apr 02, 2013 11:31 am
by leonardo

Thanks Katya. But when I click Rodrigo how do I get the text within the story node pertaining to him? That's what I need to show in the panel component.


Get image name when clicked

Posted: Tue Apr 02, 2013 12:19 pm
by Kateryna Grynko

Could you please clarify where you store "story node", from what you want to get data? Is it stored in some page component or in database or somewhere else?


Get image name when clicked

Posted: Tue Apr 02, 2013 1:40 pm
by leonardo

it's in the the xml that is loaded into the REST service. I have shared the project if you want to examine it,


Get image name when clicked

Posted: Tue Apr 02, 2013 1:59 pm
by Kateryna Grynko

What is the shared app name?


Get image name when clicked

Posted: Tue Apr 02, 2013 2:40 pm
by Maryna Brodina

Hello! You would need to save data from REST Service to some global variable (not localStorage variable). To do this add on Rest Service success event next code:

codewindow&#46;namesData = data&#46;name&#46;person;/code

Then on Click event on image or Label using JS check array windows.namesData and find necessary data.