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.
1 person has
this question
+1
This topic is no longer open for comments or replies.
  • 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.
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. happy, confident, thankful, excited kidding, amused, unsure, silly indifferent, undecided, unconcerned sad, anxious, confused, frustrated

  • 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?
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. happy, confident, thankful, excited kidding, amused, unsure, silly indifferent, undecided, unconcerned sad, anxious, confused, frustrated

  • 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.
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. happy, confident, thankful, excited kidding, amused, unsure, silly indifferent, undecided, unconcerned sad, anxious, confused, frustrated

  • I’m confused
    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.
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. happy, confident, thankful, excited kidding, amused, unsure, silly indifferent, undecided, unconcerned sad, anxious, confused, frustrated

  • Hi Dave.

    Sorry for this typo.

    This is right instructions:



    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": ""}



    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.
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. happy, confident, thankful, excited kidding, amused, unsure, silly indifferent, undecided, unconcerned sad, anxious, confused, frustrated

  • I’m anxious
    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.



    I have shared my app with support so hopefully we can figure out what I did wrong or what is missing. Thanks.
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. happy, confident, thankful, excited kidding, amused, unsure, silly indifferent, undecided, unconcerned sad, anxious, confused, frustrated

  • 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
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. happy, confident, thankful, excited kidding, amused, unsure, silly indifferent, undecided, unconcerned sad, anxious, confused, frustrated