Page 1 of 2
I want to use the delete button on a list component that loads multiple collection
Posted: Mon Oct 07, 2013 12:01 am
by Mark Veldhoff
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.
I want to use the delete button on a list component that loads multiple collection
Posted: Mon Oct 07, 2013 12:26 am
by Alena Prykhodko
Hi!
[quote:]
How can I select which service runs when I hit the button?[/quote]
Choose button-Click event-Invoke service- Choose service
I want to use the delete button on a list component that loads multiple collection
Posted: Mon Oct 07, 2013 8:21 pm
by Kateryna Grynko
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.
I want to use the delete button on a list component that loads multiple collection
Posted: Wed Oct 16, 2013 3:00 am
by Mark Veldhoff
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
I want to use the delete button on a list component that loads multiple collection
Posted: Wed Oct 16, 2013 5:41 am
by Kateryna Grynko
Hi Mark,
You can use the following code to refresh listview:
codeAppery("mobilelist_13").listview("refresh");/code
where mobilelist_13 is a listview name.
I want to use the delete button on a list component that loads multiple collection
Posted: Thu Oct 17, 2013 2:20 am
by Mark Veldhoff
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;
}
I want to use the delete button on a list component that loads multiple collection
Posted: Thu Oct 17, 2013 9:23 am
by Kateryna Grynko
Hi Mark,
Please replacecodeBreak;/codewithcodebreak;/code
JavaScript is case-sensitive.
I want to use the delete button on a list component that loads multiple collection
Posted: Sat Oct 19, 2013 1:47 pm
by Mark Veldhoff
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
I want to use the delete button on a list component that loads multiple collection
Posted: Sat Oct 19, 2013 2:12 pm
by Alena Prykhodko
I want to use the delete button on a list component that loads multiple collection
Posted: Mon Oct 21, 2013 1:26 am
by Mark Veldhoff
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?