Page 2 of 3

Manage attributes in the List Item component

Posted: Sun Aug 28, 2016 2:27 am
by EJLD

Hi Kurt, don't know what you are using to come up with such mapping. is it a jQuery app ?
anyway, I see :
1/ what is supposed to be on left is on right and opposite, are you sure this is service response from DB (not a request) ?
2/ to populate your list from DB response you might have to link the task with the list component (left), plus the DB field to your component (within the listitem)
3/ could you collapse your list that we see what is inside ?
4/ what s surprising me is that I don't see the JS asset for each item. so you might have to find another way to check your value and customize your UI component.
I cannot help you more unfortunately
Eric


Manage attributes in the List Item component

Posted: Sun Aug 28, 2016 5:59 am
by Kurt Spangsbjerg Petersen

Hi, Eric - thanks for trying. I just followed the examples from the official Appery.io guide. Surprising that such simple functions are so hard to do in the tool.
But thanks a lot for trying.


Manage attributes in the List Item component

Posted: Sun Aug 28, 2016 6:53 am
by EJLD

no problem.
I am attaching what I did ... it might give you ideas
ATB

1/ DB service response mapping
Image

2/ code in component JS asset
Image


Manage attributes in the List Item component

Posted: Mon Aug 29, 2016 2:43 pm
by Kurt Spangsbjerg Petersen

Thanks a lot. I understand what you do :-) I will figure out where to put the code.


Manage attributes in the List Item component

Posted: Tue Aug 30, 2016 8:09 pm
by Kurt Spangsbjerg Petersen

Thanks, Eric. I re-build my app from and now everything is working.

The last thing for me is to find a way to control a component based on another components value. For example if a label in the list item has a certain value then the color of another component will change. But maybe that's too hard to do :-)

Thanks for your help so far.


Manage attributes in the List Item component

Posted: Tue Aug 30, 2016 10:01 pm
by EJLD

Happy that u cld make it.

As for your contionning label, how will you bring the value to it ?


Manage attributes in the List Item component

Posted: Wed Aug 31, 2016 12:42 pm
by Kurt Spangsbjerg Petersen

Hi
I tried to do it this way (code in component JS asset):

A) if ( value == 1 ) { element.css("background", "Red"); }
B) if ( value == 2 ) { $('[name=gridcell_1]').css('background', 'Yellow'); }

A) of course it works on its own element :-)
B) it actually works to change the color of another cell. But it is ignoring the if- statement. It gives each gridcell_1 the same color.


Manage attributes in the List Item component

Posted: Wed Aug 31, 2016 12:48 pm
by EJLD

one field can feed several components. i suggest you pull a link from DB service response field (on left) to the 2nd cell you wanna change the color (gridcell_1). then, insert the same code logic as the first cell (except the color).
tell me if it works.


Manage attributes in the List Item component

Posted: Wed Aug 31, 2016 1:34 pm
by Kurt Spangsbjerg Petersen

Yes, I do exactly as you describe. The problem is that "gridcell_1" is not available in the right side of the mapping, because there are no components inside the gridcell, I just want to change the background color for it.


Manage attributes in the List Item component

Posted: Wed Aug 31, 2016 1:44 pm
by EJLD

maybe you have to make it opaque first by unchecking the backgrd transparent box on right hand panel of the builder UI (design tab). also a cell might need different code than a label. this I don't remember. I leave it to our dear Appery tech guys :)