Sorry, but we need more time.
Sorry, but we need more time.
Hi Milton,
To delete (filter) items you need to use "generic security context" and use it with your service.
ol
liCreate custom security context service. More info here - http://docs.appery.io/documentation/g.../li
liUse next code to wrap answer and make custom logic (including server requests).
precode
Appery.MySecurityGeneric = Appery.createClass(SecurityContext, {
Code: Select all
invoke: function(service, settings) {
var oldSuccess = settings.success;
var onSuccess = function(value, other){
var newValue = [];
for(var i = 0; i < value.length; i++){
//Your filter condition. Please replace it with yours.
if(!value[i].user_name.match(/^#/gi))
newValue.push(value[i]);
};
console.log(newValue);
oldSuccess.call(this, newValue, other);
};
settings.success = onSuccess;
Appery.MySecurityGeneric.$super.invoke.call(this, service, settings);
}
});/code/pre
Note: you should to replace "MySecurityGeneric" with your security generic context name./li
liWhat about your select. You have your default item selected? http://prntscr.com/3bvu8b/direct/li
/ol
And you have select with multiple selected items?
2) How do I wrap the security generic context around the Contacts Service? There are no options on the contact service (see image).
3) Yes, I have multiple property on my select. The default item is selected, but also the item at the top of the select list. I do not want either to be selected by default.
Hi Milton,
2) - open your contact service and fill "Security Context" select with your one you have already created. http://prntscr.com/3c8s3u/direct
3) For multiple select you should use the code below:
precode
//You have to change "mobileselectmenu_10" with your select component name.
var yourSelect = Appery("mobileselectmenu_10");
yourSelect.val("default");
yourSelect.selectmenu('refresh', true);/code/pre
Instead of:
precode
//You have to change "mobileselectmenu_12" with your select component name.
Appery("mobileselectmenu_12").val("default").trigger("change");/code/pre
Regards.
Illya, please look at the image I posted in the previous message. The Contact Service is a device service, there is no settings tab (just properties, request, response, and echo). I do not know how to wrap a security context for this type of service...
Dear Milton,
Sorry I did't noticed that you have device service.
So, if security context couldn't be applied, you should implement Generic (Curstom JS implementation) service.
Inside this service you should invoke your contacts device service. Process received data and return as result this data.
Please see how to implement Generic (custom JavaScript implementation) here: http://docs.appery.io/documentation/u...
Regards.
Illya,
I was able to get the Select menu to filter the results correctly with this code on the success event:
//Filter values returned from Contact Service ----------------------
Appery("Select_Friends").find("option").each(function(){
var $this = $(this);
//Remove values that contain a # or are blank
if ($this.text().trim().indexOf("#") -1||$this.text().trim().length === 0) {
$this.remove();
}
});
It still does not properly show the Default value and then not have it selected.
I want it to load my device contacts and display the default value as in Capture1. Instead it is deleting the default value as in Capture 2.
I have tried this on the contact service success event, but it does not work:
Appery("Select_Friends").val("default");
Appery("Select_Friends").selectmenu('refresh', true);
HI Milton,
To add a menu item by default run this code on page Load:preAppery("mobileselectmenuName").prepend("default");
Appery("mobileselectmenuName").selectmenu("refresh", true);
$(".ui-selectmenu-list li").removeClass("ui-screen-hidden");
$(".ui-selectmenu-list li").removeClass("ui-first-child");
$(".ui-selectmenu-list li:nth-child(1)").addClass("ui-first-child");/preWhere 'mobileselectmenuName' is a Select component name.
Katya, I can not get this to work. I am populating my Select component with a service, so I tried it on page Load as well as the service Success event but neither adds the default option.
Here is my public link:
http://appery.io/app/view/5c789ef0-c7...
And the code I added:
Appery("Select_Friends").prepend("default");
Appery("Select_Friends").selectmenu("refresh", true);
$(".ui-selectmenu-list li").removeClass("ui-screen-hidden");
$(".ui-selectmenu-list li").removeClass("ui-first-child");
$(".ui-selectmenu-list li:nth-child(1)").addClass("ui-first-child");
Hi Milton,
Please try this solution:
ol
liAdd you select one more item with "default" value and "default" key. http://prntscr.com/3cvot2/direct/li
liComment code:
precode
Appery("Select_Friends").prepend("default");
Appery("Select_Friends").selectmenu("refresh", true);
$(".ui-selectmenu-list li").removeClass("ui-screen-hidden");
$(".ui-selectmenu-list li").removeClass("ui-first-child");
$(".ui-selectmenu-list li:nth-child(1)").addClass("ui-first-child");/code/pre/li
liChange your code in friends_success event handler with:
precode
//Filter values returned from Contact Service ----------------------
Appery("Select_Friends").find("option").each(function(){
var $this = $(this);
//Remove values that contain a # or are blank
var itemText = $this.text().trim();
if (itemText.indexOf("#") > -1 || itemText.length === 0) {
$this.remove();
}
});
//Appery('Select_Friends').val('default').selectmenu('refresh');
Appery("Select_Friends").val("default");
Appery("Select_Friends").selectmenu('refresh', true);
//Add Default to Friends selector---------------------------------------------
/code/pre/li
/ol
Regards.