Mark Veldhoff
Posts: 0
Joined: Mon Oct 07, 2013 12:01 am

I want to use the delete button on a list component that loads multiple collection

I've got a delete button in a grid on a list. I have two different DB.collections that loads on this list. Currently when you click on the delete button it first sets a local variable with the ID then it runs a "delete" service and then an "update" service. However, this only works for one collection. How can I select which service runs when I hit the button? When I load the list(from a manage button) I set a local variable with the list name in it.

*I couldn't use the delete button with the list component because I also want to have the search function. When I turn on the search function the delete button goes away. That is why I had to put the grid in the list.

Alena Prykhodko
Posts: 0
Joined: Tue Apr 09, 2013 7:36 am

I want to use the delete button on a list component that loads multiple collection

Hi!

[quote:]
How can I select which service runs when I hit the button?[/quote]
Choose button-Click event-Invoke service- Choose service

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

I want to use the delete button on a list component that loads multiple collection

Hi Mark,

You can also run JavaScript on click event where invoke a service depending on the variable value, for example:
codeswitch(myservice){
case "first":{
firstservice.execute();
break;
}
/....
}/code
However, you would need to create services for different collections. If there are too many services then you would need to rethink your database structure.

Mark Veldhoff
Posts: 0
Joined: Mon Oct 07, 2013 12:01 am

I want to use the delete button on a list component that loads multiple collection

This answered my first question...Thanks.

Now my problem is reloading the list after I delete the item. Everything seems to work except for my list service. I know the list service works because I am using it on other buttons. I know my switch statement works because it is deleting the correct item. I just have to hit a button that runs the list_services to do a "manual" refresh.

Here is my javascript:
var a=localStorage.getItem( "_manageType" )
switch(a){
case "horses":
HorseInfo_Delete_Service.execute();
HorseInfo_List_Service.execute();
Break;
case "Expenses":
ExpenseCat_Delete_service.execute();
ExpenseCat_list_service.execute();
Break;
}

Any thoughts on why the list services would not reload the list?

MAV

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

I want to use the delete button on a list component that loads multiple collection

Hi Mark,

You can use the following code to refresh listview:
codeAppery("mobilelist_13").listview("refresh");/code
where mobilelist_13 is a listview name.

Mark Veldhoff
Posts: 0
Joined: Mon Oct 07, 2013 12:01 am

I want to use the delete button on a list component that loads multiple collection

i added your code to mine and I'm still not getting the list to refresh. Google debugging tools does not show any method for neither code options(the one from my earlier comment and this one).

var a=localStorage.getItem( "_manageType" )
switch(a){
case "horses":
HorseInfo_Delete_Service.execute();
Appery("ManageList").listview("refresh");
Break;
case "Expenses":
ExpenseCat_Delete_service.execute();
Appery("ManageList").listview("refresh");
Break;
}

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

I want to use the delete button on a list component that loads multiple collection

Hi Mark,

Please replacecodeBreak;/codewithcodebreak;/code
JavaScript is case-sensitive.

Mark Veldhoff
Posts: 0
Joined: Mon Oct 07, 2013 12:01 am

I want to use the delete button on a list component that loads multiple collection

That did not resolve the issue. I am still getting the same symptoms.

This is happening with both the add button and the delete button. However, if I use "HorseInfo_List_Service.execute(); " vs. "Appery("mobilelist_13").listview("refresh");" on the add button it works correctly. However, the delete button still does not refresh.

MAV

Mark Veldhoff
Posts: 0
Joined: Mon Oct 07, 2013 12:01 am

I want to use the delete button on a list component that loads multiple collection

Yes - I'm using the debugger. i don't see any errors. I can see that the get method for the refresh is happening with no errors. However, it never refreshes. Like I said above that the "add" button works but the "delete" button does not. The only difference between the two buttons is that the delete button is located inside of the list that I am refreshing where the "add" button is located outside of the list. Am I allowed to run the refresh from inside of the list that I am refreshing?

Return to “Issues”