mui-tree-select set value selected by default - material-ui

I'm trying to set default value to this package "mui-tree-select" But I cant do it please some help me out this.
with this sandbox code https://codesandbox.io/s/github/mikepricedev/mui-tree-select

you need to pass selected array of id selected item as a props to TreeView component
<TreeView selected={selected} >.....
this link could help you :
https://www.geeksforgeeks.org/react-mui-treeview-api/

You can set defaultSelected to default selected nodeId property.
const defaultSelectedNodeId = 0;
<TreeView defaultSelected={defaultSelectedNodeId}>
<TreeItem nodeId="0" label={lable}></TreeItem>
</TreeView>

Related

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.

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

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");

ComboBox : retrieving value of the selected Item

I am using ComboBox for Dropdown. and when I am select the item,it doesnot pick the value of it.
Code for comboBox :
final SimpleComboBox<String> combo = new SimpleComboBox<String>();
combo.setForceSelection(true);
combo.setTriggerAction(TriggerAction.ALL);
combo.setFieldLabel("Calculation MethodNames");
combo.add(cList);
formPanel.add(combo);
I am retrieving the value as below:
fundSalesCreditCalcMethodDTO.setCalculationMethodName(calculationMethodName.getValue(calculationMethodName.getSelectedIndex()));
Can somebody please help

How to set a textbox value with the selected value of Bootstrap Typeahead?

I have the following gwt-bootstrap ui.xml :
<b:Typeahead ui:field="typeahead">
<b:TextBox ui:field="searchBox" searchQuery="true"
placeholder="Search..." />
</b:Typeahead>
How can i programmatically take the suggested response "On Click" of the the typeahead item and set it as Text into the searchbox?
Well the Adarsha Answer dont really work in my case, because i use full gwt. So my Solution is :
typeahead.setUpdaterCallback(new Typeahead.UpdaterCallback() {
#Override
public String onSelection(Suggestion selectedSuggestion) {
String text = selectedSuggestion.getDisplayString();
return null;
}
});
The below link will definitely helps you -
Get selected items value for Bootstrap's typeahead
once you get the selected value its just a matter of doing textbox.setValue(value).

ASPxGridView: How to disable GridViewDataColumn when a GridViewDataCheckColumn is checked or unchecked?

I have an ASPxGridView with the following columns:
<dx:GridViewDataCheckColumn FieldName="ProtocolEnabled" Caption="Protocol Enabled">
<DataItemTemplate>
<asp:Literal ID="ltProtocolEnabled" runat="server" />
</DataItemTemplate>
</dx:GridViewDataCheckColumn>
<dx:GridViewDataColumn FieldName="ProtocolCount" Width="0" Caption="Protocol Count">
The checkbox column has a template with a literal in it so I can display Yes/No instead of an empty checkbox, but that's probably TMI. What I need to do is this:
In edit mode: When ProtocolEnabled is checked, I need to enable the ProtocolCount textbox. When ProtocolEnabled is unchecked, I need to disable ProtocolCount and set its text to 0.
I am not asking for a step-by-step, but a general pointer in the right direction. I would like to use callbacks if at all possible. I also promise I will not delete this question as you are answering it =P.
Update: Thanks to answerer, I was sent in the direction I needed to go. Here's the code I used:
<dx:GridViewDataCheckColumn FieldName="ProtocolEnabled" Caption="Protocol Enabled" CellStyle-HorizontalAlign="Left">
<DataItemTemplate>
<asp:Literal ID="ltProtocolEnabled" runat="server" />
</DataItemTemplate>
<PropertiesCheckEdit>
<ClientSideEvents CheckedChanged="function(s,e) {ProtocolEnabledChecked(s);}" />
</PropertiesCheckEdit>
</dx:GridViewDataCheckColumn>
<dx:GridViewDataColumn FieldName="ProtocolCount" Width="0" Caption="Protocol Count">
function ProtocolEnabledChecked(ck) {
var x = gvApplicationServer.GetEditor("ProtocolCount");
if (ck.GetValue()) {
x.enabled = true;
}
else {
x.SetValue(0);
x.enabled = false;
}
}
It's clientside code instead of callback.
First of all Check this for Accessing Controls Contained within Templates
To show Yes/No
On HtmlRowCreated Event access control and set it's text property after finding the control in the
Literal literal = ASPxGridView1.FindRowCellTemplateControl(e.VisibleIndex,
ASPxGridView1.Columns["Name"] as GridViewDataColumn, "ASPxButtonEdit1") as Literal ;
literal.Text = (bool)grid.GetRowValues(e.VisibleIndex, "columnName") ? "Yes" : "No";
In Edit Row Template Do as you did as above..
If you want to do some client side functionality then .. create client side event OnClientClick and use checkbox client side method. chkclientinstanceName.getValue(); or other to check with it is checked or not..
these controls are client accessible so enable/ disable by using txtClientName.SetEnabled(true/false);
for more help go to the
DevExpress.Web.ASPxEditors ClientScript namespace..
Try this step by step .. hope it will be helpful..