It appears to not be possible to programmatically select a specific value in the Kendo DropDownList element. I checked the API, but wasn't able to find something to trigger this.
There is a selectionChange event, but this is triggered by manually selecting a value from the dropdown. I'm interested in programmatically selecting an event; is there any way to do this?
Kendo does not take the new value unless we trigger the change event for the drop-down list. Once we set the value we have to trigger the change event
var menulist = $("#menulist").data("kendoDropDownList");
dropdownlist.value("Top");
dropdownlist.trigger("change");
Add the following to the dropdown html tag: (selectionChange)="selectionChange($event)"
And add the following to your typescript code:
protected selectionChange(value): void {
console.log("The current value is: " + value)
}
To change the selected item from the code behind, use this: http://www.telerik.com/kendo-angular-ui/components/dropdowns/api/DropDownListComponent/#toc-value
Related
Can some help me to hide Actions button in Sales Order screen for Transfer Order type, please suggest.
You can use following line of code to hide button pOSupplyOK, which has title PO Link:
Base.Actions["pOSupplyOK"].SetVisible(false);
You can find necessary value of string via looking into source code like this:
Acumatica creates array of each button, and indexes it by string name of action.
you can put it on the DAC_RowSelected event and make the buttons not visible by using
if(row.DocumentType?(I can't remember the field) == TransferOrderType) //just a pseudocode.
{
Base.ButtonVariableNameHere.SetVisible(false);}
Is there any way to select a grid row from code so you can trigger the selectionChange event emitter? I don't know how to get hold of the grid component and execute the event manually.
Selection grid sample plunkr
<kendo-grid [data]="gridView" [selectable]="true"></kendo-grid>
--
Edit: If I access the grid manually by adding a #gridReference tag into the kendo-grid tag, I can access the component using
#ViewChild('activityGrid') gridReference: GridComponent;
But when executing
var selectionEvent = { index: 0, selected: false } as SelectionEvent;
this.gridReference.selectionChange.emit(selectionEvent);
It still doesn't work. It migth work when I have to access the SelectionService using unselect but that's a private class.
Updated plunkr
This could be achieved now by utilizing the new SelectionDirective. It allows specifying the key to be stored when selecting a row and also the selectedKeys collection to hold reference to the selected keys. This also allows to programatically modify the selection.
Unfortunately, currently it is not possible to select a row programmatically via the public API.
The selectionChange emitter is there to trigger the selectionChange event and I'm afraid it will not trigger the selection logic.
I have a viewPanel using DB2 for the datasource. I have created a comboBox containing all the possible viewPanel columns, a radioGroup to select ASC or DESC, a comboBox containing all the possible viewPanel columns with an onchange event to partially update the values in another comboBox, and a final comboBox that has all the values from DB2 according to the previous comboBox value that has an onchange event to partially update the viewPanel.
The onclick event for my button has this code and does a partial update of the viewPanel:
var sort:String = getComponent('comboBox1').getValue();
var order:String = getComponent('radioGroup1').getValue();
var vp = getComponent('panel_container').getData()[0];
vp.setDefaultOrderBy(sort + " " + order)
The problem is that I have to click the button twice to get the code to actually run. The first click is ensuring the onchange event is fired, then the second click activates the code. I have tried to use Full Update and checking the 'Set partial execution mode' with the partial update.
How do I get the onclick event for my button to work on the first click?
Too much event tango :-) Here is what I would do:
bind your combo boxes to viewScope variables. That's more robust than getValue() and allows to change the UI later (fancy some d&d)
use the combo box client side, not the server side onChange() event. This would require all values to be send down eg via Ajax
when you click the button make sure the fields are inside the panel you refresh
Hope that helps
Let's start with saying that I'm using GXT 2.2.5 on GWT 2.3.0.
My goal is to present the user with a set of data retrieved from a query where he needs to specify a value for one of the fields. As an example, let's say the query returns a list of phone numbers, and the user needs to sepcify the type of number (i.e., Home, Office, Cell, or Pager) each is.
So I'm looking at the EditorGrid as a potential solution. The grid would display the type and number, with a ComboBox attached to the first field through a CellEditor.
The requirement is that the user must select a type for each number. How do I enforce this? I can set allowBlank to false on the ComboBox, but how do I manage it? How do I validate the grid?
I've searched for an answer, but have been unsuccessful.
I suggest the use of the Grid, not the EditorGrid. When using a RowEditor within the Grid the allowBlank validation (or any other fields validator) are fired when the user saves row changes.
Here is a little example in case you are not familiar with the Grid:
ColumnConfig colNombre = new ColumnConfig("name", "Name", 200);
TextField<String> txtNombre = new TextField<String>();
txtNombre.setAllowBlank(false);
txtNombre.getMessages().setBlankText("IT CANT BE EMPTY.");
colNombre.setEditor(new CellEditor(txtNombre));
configs.add(colNombre);
re = new RowEditor<BeanModel>();
re.addListener(Events.AfterEdit, new Listener<RowEditorEvent>() {
public void handleEvent(RowEditorEvent e) {
editar(e);
}
});
re.setClicksToEdit(ClicksToEdit.TWO);
grid = new Grid<BeanModel>(STORE, new ColumnModel(configs));
grid.addPlugin(re);
hope it helps.
Have a SimpleComboBox<String> to store all types of numbers (Home, Office etc). Attach it to the EditorGrid. Set the setEditable(false) property for SimpleComboBox<String>, and make sure that a valid "type" is selected by default in the combo-box (using setValue(...)).
In this way, when your Grid gets rendered, the phone numbers will have type beside them, having a default value selected.
I feel that this is a good approach, rather than having combobox with blank value initially, and then asking user to fill it by showing validation error.
I found a solution to implement custom actions for the prev and next buttons in a Fullcalendar.
But I don't know, how I can use it for my case. I want to change the displayed date range of the <p:calendar> if the <p:schedule> switches into the next month/year and the same for the other direction. My construct looks like a simple Outlook Calendar.
I gave the <p:calendar> the possibility to update the <p:schedule>'s initalDate on dateSelect. So the schedule is hopping to the date range of the selected date. But how can I handle the event, if the <p:schedule> has 'month' view and the user decide to go in another month by clicking the prev/next button? The same i got if the user uses <p:calenadar> Buttons and Navigator.
My first idea was to create a ManagedBean which save the state of the current date range. And call an custom event if the previous/next buttons or the navigator get clicked. This event compare the given ranges and update. But I think this isn't possible or is it?
Thanks for your replies.
You have to use a LazyScheduleModel Object to do that
ScheduleModel eventModel = new LazyScheduleModel() {
#Override
public void loadEvents(Date start, Date end) {
handlePreviousNext(start, end);
}
};