how to set selected value in sap.m.searchfield ui5 - sapui5

I have used a sap.m.SearchField in(SAPUI5),
Now I want to set one of the suggestion item as selected, I mean I want to set a default value to the search field.
How to set selected value in sap.m.SearchField?

While defining SearchField itself you can set the value.
var oSearchField = new sap.m.SearchField({
value: "samplePreText"
});
If you plan to change on some event:
oSearchField.setValue("samplePreText");

Related

Extjs form setting a value

I set the date value through the Extjs value form property, but the function to clear the field does not appear in the field itself, which is present when setting the value from the calendar. What should be done?
enter image description here
enter image description here
In ext 7.5 you should add trigger to your field.
triggers: {
clearTrigger: {
cls: 'x-form-clear-trigger',
handler: function() {
//function to clean field
}
}
}

Combobox component for Swift, select an element by default

I'm using this component:
https://github.com/Darkseal/DownPicker
let persons = ["Architect", "Designer", "Chef", "Doctor"]
self.personDownPicker = DownPicker(textField: self.personTextField, withData:persons)
And it's displaying the data correctly, but, how I can have an option selected by default?
Just looking into the source code, the DownPicker instance has a selectedIndex property. Set it to the index of the selected item.

Kendo Grid Change Displayed Value

Given an initialized and displayed Kendo Grid. I want to change the value on a column when either the detailExpand or detailCollapse event occurs. How do I change a displayed value? This is an MVVM initialized grid, but it appears that changes to the data source do not update the displayed values in the grid. So much for data binding.
OnDetailCollapse: function(e) {
var self = ScenarioManager.MasterGridViewModel;
var data = e.sender.dataItem(e.masterRow);
var product = self.FindProductById(self.get('Products').data(), data.Id);
product.set('MrcDisplay', product.MrcSubTotal); // This does nothing
product.set('NrcDisplay', product.NrcSubTotal); // This does nothing
},

How to Date field of datepicker non editable

For Xamarin.Forms.DatePicker, the date field is "tappable" , the user can change the date after selecting it in the date picker. How to make the data field non-editable(read-only)?
You have to set IsEnabled=false
<DatePicker IsEnabled="false"/>
IsEnabled is the property of VisualElement from which all controls are inherited.
It Gets or sets a value indicating whether this element is enabled in the user interface. This is a bindable property.
public Boolean IsEnabled { get; set; }
true if the element is enabled; otherwise, false. The default value is
true.
If false, Elements are not enabled to participate in hit detection, and therefore will not receive focus or emit input events.
Issue is resolved when i added Control.ShouldChangeCharacters += (field, range, replacementString) => false; to custom renderer file

jqgrid single select checkbox

In Jqgrid, I want to restrict user to select only one check box at any time. When user selects multiple check box only last selected to be in 'selected' state, remaining should be automatically un-selected.
I have set multi select attribute to true. But I am not able to do un-select previously selected item. Is it possible to do if so how?
Thanks
You can use the event beforeSelectRow and reset the selection:
beforeSelectRow: function(rowid, e)
{
jQuery("#list47").jqGrid('resetSelection');
return(true);
}
I've got a fiddle for you so you can check how it works.
You have to do some more stuff:
1. Set multiboxonly to true and multiselect to true
2. Define the events onSelectRow and beforeSelectRow:
3. Define global variable: var lastSel;
The OnSelectRow and beforeSelectRow implementation:
onSelectRow: function (rowId, status, e) {
if (rowId == lastSel) {
$(this).jqGrid("resetSelection");
lastSel = undefined;
status = false;
} else {
lastSel = rowId;
}
},
beforeSelectRow: function (rowId, e) {
$(this).jqGrid("resetSelection");
return true;
}
Having a checkbox in each column implies that you can click more than one at a time. What you are asking for is basically the multiselect: false behavior but with the checkbox column - are you sure you really want the checkboxes in this case?
I know this question is old, but I found a better solution in this Stack Post.
All you have to do is set the following two properties of the jqGrid:
multiselect:true // multi-select checkboxes appear
multiboxonly:true // checkboxes act like radio buttons where only one is selected at a time
I have updated the fiddle made by LeftyX to simply use the multiboxonly setting at this JsFiddle
This was what I needed. It may help someone else.