Page 1 of 2

Split list button - text repeating

Posted: Mon May 12, 2014 3:17 pm
by Anthony Hyams

I have a list which is formatted with the split button behaviour.

I run some js to format and add some extra info to the list. this runs at the start of the loop $

var d = new Date(value.start);
var info = " Starts at " + convertdate(d) + "

";
element.append(info);

This just gets a date then converts it to am/pm format and adds it to the list. All works fine except the appended info appears in the list and in the split button. Is there a way of having it only append to the left hand part of the list and not on the split button?


Split list button - text repeating

Posted: Mon May 12, 2014 3:40 pm
by Evgene Karachevtsev

Hello Anthony,

You should "add JS" with your custom code only to the "text" field in list item.
Here is more about adding JS: http://docs.appery.io/documentation/r...


Split list button - text repeating

Posted: Mon May 12, 2014 4:30 pm
by Anthony Hyams

The problem with that answer is when I enquired about adding several data items to a list in this question

https://getsatisfaction.com/apperyio/...

The conclusion was you had to add the custom js before the text field. Read the final two posts.

One of the issues being as far as I am aware I can only access the one value mapped to the text field when I need to string together several values. These are available in the $ array as value.date and value.name etc but not at the text field level.

The other issue being when stuff is mapped to localstorage. If i map the info to local storage and then output it at the text field level we found that it was all out of sync. Is there no simple way of not having it repeat on the split button as it works fine apart from that


Split list button - text repeating

Posted: Mon May 12, 2014 7:04 pm
by Evgene Karachevtsev

You should "add JS" with your custom code only to the "text" field in list item.
Here is more about adding JS: http://docs.appery.io/documentation/r...


Split list button - text repeating

Posted: Mon May 12, 2014 10:32 pm
by Anthony Hyams

Seeing as just repeating what you said before is considered "support" here's my last response again... but at least I've added an extra line

The problem with that answer is when I enquired about adding several data items to a list in this question

https://getsatisfaction.com/apperyio/...

The conclusion was you had to add the custom js before the text field. Read the final two posts.

One of the issues being as far as I am aware I can only access the one value mapped to the text field when I need to string together several values. These are available in the $ array as value.date and value.name etc but not at the text field level.

The other issue being when stuff is mapped to localstorage. If i map the info to local storage and then output it at the text field level we found that it was all out of sync. Is there no simple way of not having it repeat on the split button as it works fine apart from that


Split list button - text repeating

Posted: Tue May 13, 2014 2:31 pm
by Evgene Karachevtsev

Hello Anthony,

How can we reproduce this problem in your app?


Split list button - text repeating

Posted: Tue May 13, 2014 10:40 pm
by Anthony Hyams

I have already shared app with support. If you open it. Click the login button - top right. Enter username: apptest password: apptest

Then click the schedule button. I have populated that account with two events and you will see on the split button on the right that the text is repeated above the X


Split list button - text repeating

Posted: Wed May 14, 2014 4:04 pm
by Evgene Karachevtsev

Hello,

Use this code in the mapping:

code
element.attr("data-item-id", value._id);
var d = new Date(value.start);
var info = "<p class=\/codecode"sched_date\/codecode">Starts at " + convertdate(d) + "</p>&quot
element&#46;find("&#46;ui-li-heading")&#46;append(info); /code


Split list button - text repeating

Posted: Wed May 14, 2014 8:29 pm
by Anthony Hyams

works like a dream thank you very much


Split list button - text repeating

Posted: Fri May 16, 2014 9:51 pm
by Anthony Hyams

after upgrading to version 2 libraries for another issue this broke.. however when I reverted back to the original code in the question that now worked as expected. So the above answer is good for 1.0 libraries not for 2.0 for 2.0 just use the element.append(info);