Page 2 of 3

Event not firing

Posted: Thu Jun 26, 2014 1:23 am
by Yurii Orishchuk

Hi Aenas.

I've tried following code and it's seem to be ok:

pre

Apperyio("mobilecollapsblock_25").bind( "collapsibleexpand", function( event, ui ) {
var currentElement = jQuery(event.target);

Code: Select all

 alert('Expand1 = ' + currentElement.find('[name="mobilecollapsblockheader_26"]').text());  
 event.stopPropagation(); 

} );

Apperyio("mobilecollapsblock_28").bind( "collapsibleexpand", function( event, ui ) {
var currentElement = jQuery(event.target);

Code: Select all

 alert('Expand2 = ' + currentElement.find('[name="mobilecollapsblockheader_29"]').text());  
 event.stopPropagation(); 

} );

/pre

So, please check whether you set correctly header component name in this code.

Regards.


Event not firing

Posted: Thu Jun 26, 2014 4:19 am
by Aeneas McBurney

Thanks for your help and now for a weird one. After managing to get the event to work I added this code which needs to remove the last 5 characters from the end of the header text.

Apperyio("collapseMessages").bind( "collapsibleexpand", function( event, ui ) {
var currentElement = jQuery(event.target);

var read=currentElement.find('[name="lblMsgRead"]').text();

Code: Select all

 if(read==='false'){ 
    //remove (NEW) from subject 
    var subj =currentElement.find('[name="headermsgdate"]').text(); 
    var subjlen=subj.length; 
    var newsubj=subj.substring(0,subjlen-5); 
    currentElement.find('[name="headermsgdate"]').text(newsubj); 

 } 

 //event.stopPropagation();  

});

Here are the before and after event screenshots.
Image


Event not firing

Posted: Thu Jun 26, 2014 4:31 am
by Aeneas McBurney

UPDATE: If I add a label to the header and update that instead it works


Event not firing

Posted: Thu Jun 26, 2014 4:43 am
by Yurii Orishchuk

Aenas,

Why did you coment this line of code?:

pre

//event.stopPropagation();

/pre

Please uncoment it and try again.

Regards.


Event not firing

Posted: Thu Jun 26, 2014 5:07 am
by Aeneas McBurney

I uncommented but same result.

Another quick question on mapping data from a json dataset. On mapping I am writing the Read field (true/false) to a localStorage variable(msgRead) to use to combine with the subject field using this js

if(localStorage.getItem('msgRead')==='false'){
return value + '(NEW)';
}
else
{ return value;}

The 'NEW' string is being added to the next record and not the current one as it should. How can I change this behaviour? Is there a way to reference another field in the same dataset instead of writing to a localstorage var?


Event not firing

Posted: Thu Jun 26, 2014 6:32 am
by Kateryna Grynko

Hi Aeneas,

As for a collapsible block, are the any console errors when you are running the code?

As for a localStorage variable, add your label to a collaplible block and hide it (use parameter "visible" in Propeerties panel).

Add mapping to this label instead of locaStorage, then read it this way:
prevar text = $(this).parent().find("[name=labelName]").text();/preWhere labelName is a name of the label.


Event not firing

Posted: Thu Jun 26, 2014 9:09 am
by Aeneas McBurney

I have a label within the collapsible called lblMsgRead which I am passing the read field to. The below is the code I've tried in the mapping to the collapsible header label as suggested but for both I'm getting nothing for each of these alerts.

alert($(this).parent().find("[name=lblMsgRead]").text());
alert($(this).find("[name=lblMsgRead]").text());


Event not firing

Posted: Thu Jun 26, 2014 9:46 pm
by Yurii Orishchuk

Hi Aeneas,

Please give us your app public link.

And describe what do you want to implement. And what does not work.

Regards.


Event not firing

Posted: Thu Jun 26, 2014 9:57 pm
by Aeneas McBurney

Hi Yurii,

I shared my link with your support team yesterday.

What I am trying to do is quite simple in that I have a dataset of messages going to a collapsible. If the read field is false I want to add "(NEW)" to the subject on mapping. The subject is in the collapsible header. I have tried writing the read field to local storage variable and using it in the mapping of subject but that adds it to the next record. I then tried adding a hidden label item and mapping to it as suggested by Katya but that also did not work.

Let me know if you need anything else.

Thanks,
Aeneas


Event not firing

Posted: Sun Jun 29, 2014 10:11 pm
by Yurii Orishchuk

Hi Aeneas.

Sorry for late answer.

I've tested your message page(called "main") and can not reproduce your problem.

See details here: http://prntscr.com/3xsein/direct

Thus we need your details steps to reproduce the problem.

Regards.