Dave Troxel
Posts: 0
Joined: Fri May 09, 2014 1:07 pm

How can I show/hide UI list items (database rows)?

I want the ability to hide/show database rows via the UI list of my application.

Example, if my UI list page looks like this:

Apples / Red / Delicious [Hide Button]
Oranges / Medium / Florida [Hide Button]
Pears / Small / Bartlet [Hide Button]
Grapes / Red / Seedless [Hide Button]

I click on the Hide buttons for Oranges and Grapes, the rows are RETAINED in the DB but now my UI list page looks like this:

Apples / Red / Delicious [Hide Button]
Pears / Small / Bartlet [Hide button]

I would also like the ability to create a UI list page that only shows the hidden rows:

Oranges / Medium / Florida
Grapes / Red / Seedless

Please suggest how I go about doing this.

Igor
Posts: 0
Joined: Tue Apr 02, 2013 12:05 pm

How can I show/hide UI list items (database rows)?

Hello,

You can add additional column "HideItem" in your DB with value true or false. You can use where clause to show not hidden rows and On the hide button click you can update "HideItem" value in you DB.

Dave Troxel
Posts: 0
Joined: Fri May 09, 2014 1:07 pm

How can I show/hide UI list items (database rows)?

Igor, I get it, but I don't get it.

I have created the new column 'HideItem' in my DB.

Do I have to build a 'where statement' and where do I put it?

Also, how do I tell my button click to update HideItem?

Yurii Orishchuk
Posts: 0
Joined: Fri Feb 14, 2014 8:20 am

How can I show/hide UI list items (database rows)?

Hi Dave.

If you need to see only "not hidden" items you should use "query" service datasource with "where" clause: {"HideItem": "true"}

If you need to see only "not hidden" items you should use "query" service datasource with "where" clause: {"HideItem": ""}

What about updating:

When user click on the "hidden" button you need to invoke "update" service datasource with request parameter "HideItem" = "true"

Please follow this tutorial to understand how to do update item:

http://devcenter.appery.io/tutorials/...

You also need use "update" service instead of "create" and pass itemId into each item(like on delete tasks section).

Regards.

Dave Troxel
Posts: 0
Joined: Fri May 09, 2014 1:07 pm

How can I show/hide UI list items (database rows)?

Yurii, were you in a hurry when you wrote this? The first two lines:
If you need to see only "not hidden" items you should use "query" service datasource with "where" clause: {"HideItem": "true"}

If you need to see only "not hidden" items you should use "query" service datasource with "where" clause: {"HideItem": ""}
You gave the same instruction for totally different scripts. Which is which?

Then the comment about updating:
When user click on the "hidden" button you need to invoke "update" service datasource with request parameter "HideItem" = "true"
Where do I place the request parameter "HideItem" = "true"? Do I have to create a 'where' in the request for the update service as well?

When deleting I have to use a local storage variable in the "list" service. Don't I need that as well somewhere?

Please clarify.

Yurii Orishchuk
Posts: 0
Joined: Fri Feb 14, 2014 8:20 am

How can I show/hide UI list items (database rows)?

Hi Dave.

Sorry for this typo.

This is right instructions:

precode

If you need to see only "hidden" items you should use "query" service datasource with "where" clause: {"HideItem": "true"}

If you need to see only "not hidden" items you should use "query" service datasource with "where" clause: {"HideItem": ""}

/code/pre

Q - Where do I place the request parameter "HideItem" = "true"? Do I have to create a
A - You need to:
1 add to the item hidden label with name "itemId". And fill it with "id" property from list service. See details here: http://devcenter.appery.io/tutorials/...
2 on "hide" button click - add "Set local storage variable" action like on screen shot: http://prntscr.com/3razd0/direct
3 on "hide" button click - add one more "invoke service" action. With "update" service selected.
4 Open "update" service mapping and add mapping from "itemId" LSV to the "id" property. And set "true" value for "HidenItem" request property. See details: http://prntscr.com/3rb0zc/direct

Q - Do I have to create a 'where' in the request for the update service as well?
A - Nope, this clause used only with "list" and "query" services.

Q - When deleting I have to use a local storage variable in the "list" service. Don't I need that as well somewhere?
A - You have to use "itemId" LSV for "update" service. You dont have "delete" service in described usecase.

Regards.

Dave Troxel
Posts: 0
Joined: Fri May 09, 2014 1:07 pm

How can I show/hide UI list items (database rows)?

Ok Yurii, I have completed the above steps.

Is there a datasource event that has to be written also?

Currently, I cannot see my list at all now. Please advise.

Image

I have shared my app with support so hopefully we can figure out what I did wrong or what is missing. Thanks.

Dave Troxel
Posts: 0
Joined: Fri May 09, 2014 1:07 pm

How can I show/hide UI list items (database rows)?

UPDATE This list is showing again, but the HideItem is not working still. Please have a look and let me know where I am broken.

Yurii Orishchuk
Posts: 0
Joined: Fri Feb 14, 2014 8:20 am

How can I show/hide UI list items (database rows)?

Hi Dave.

Were you in a hurry when made provided steps?

You have next mistakes:

1 wrong "itemID" LSV instead of "itemId" that's i have provided above.

See details: http://prntscr.com/3rnygf/direct

2 don't set "HidenItem" request parameter.

See details: http://prntscr.com/3rnyza/direct

3 Your list service should have "where" parameter. Where you need to set filter '{"HideItem": false}'. It's was changed because you use "boolean" type in DB instead of "string"

http://prntscr.com/3ro0u1/direct

4 Also you need reload list on success event of update service.

Regards

Return to “Issues”