EJLD
Posts: 0
Joined: Sun Jun 08, 2014 11:03 pm

Manage attributes in the List Item component

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

Kurt Spangsbjerg Petersen
Posts: 0
Joined: Wed Aug 17, 2016 8:51 pm

Manage attributes in the List Item component

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.

EJLD
Posts: 0
Joined: Sun Jun 08, 2014 11:03 pm

Manage attributes in the List Item component

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

Kurt Spangsbjerg Petersen
Posts: 0
Joined: Wed Aug 17, 2016 8:51 pm

Manage attributes in the List Item component

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

Kurt Spangsbjerg Petersen
Posts: 0
Joined: Wed Aug 17, 2016 8:51 pm

Manage attributes in the List Item component

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.

EJLD
Posts: 0
Joined: Sun Jun 08, 2014 11:03 pm

Manage attributes in the List Item component

Happy that u cld make it.

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

Kurt Spangsbjerg Petersen
Posts: 0
Joined: Wed Aug 17, 2016 8:51 pm

Manage attributes in the List Item component

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.

EJLD
Posts: 0
Joined: Sun Jun 08, 2014 11:03 pm

Manage attributes in the List Item component

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.

Kurt Spangsbjerg Petersen
Posts: 0
Joined: Wed Aug 17, 2016 8:51 pm

Manage attributes in the List Item component

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.

EJLD
Posts: 0
Joined: Sun Jun 08, 2014 11:03 pm

Manage attributes in the List Item component

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 :)

Return to “Issues”