How to detect click on mapbox-gl-geocoder results (suggestions)? - mapbox-gl-js

When I type in and get a dropdown with suggestions (suggestions-wrapper) - is it possible to get the click event on an item in the dropdown list? Thanks.

You can subscribe to the result event:
geocoder.on('result', result => console.log(result));

Related

Ax 2012 drop down selection

HI i am having an issue with drop down in ax 2012, i have 5 classes and i display them in the dropdown using their displaynames(i.e lookup of classes), but when i select on one of them and again click on dropdown the current value is not highlighted or cursor is not present on that value, cursor always points to the first value when i press drop down, it is not likely with the other dropdown in ax like enums the current value is highlighted when i press dropdown, please help me in resolving this issue thanks in advance.
dont have any data source on the form i am using edit method and lookup method for drop down here is the code i used please help me in solving this issue.
public void lookup()
{
List entityList;
entityList = CsSysClassUtil::getImplementedClasses(classStr(CsPsqIInstructNavigator));
CsSysClassUtil::createLookUp(this, entityList);
}
// this will display the selected value from the lookup in the field
public edit ClassName editProdOrderSearchDirection(
boolean _set,
ClassName _searchDirectionClassName)
{
if (_set)
{
if (CsSysClassUtil::validateInterface(
_searchDirectionClassName,
classnum(CsPsqIInstructNavigator),
CsSysMessageType::Info))
{
gProdOrderSearchDirection = _searchDirectionClassName;
}
}
return CsSysClassUtil::getClassDisplayName(className2Id(gProdOrderSearchDirection));
}
But when i again press the drop down the cursor is not highlighting the selected value or current value. its always high lighting the first value in the drop down. I want to high light the current value when drop down is clicked.(like it behaves with standard look up or enum look up)
following is the link for image of dialog
http://screencast.com/t/BNF6n3DkxKMc
In the above screen we can see value in the Search in (text control) is 'Next production order', but when drop down is clicked its highlighting 'current production order', i want to highlight 'Next production order' i.e value in the text control must be highlighted.
You can call findValue on the FormDataSource.
FormDataSource fds = _form.dataSource(1);
fds.findValue(fieldNum(_table_, _field_), this.valueStr());

Tooltip on combox Item

I want a tool tip on the drop down list for combox items. I have a combobox and showing combobox item in that combobox on selected index change of drop down, but it is note helping me too much.
Since my dropdown size is small, and items in the dropdown are very big, it's become difficult for users to select the proper value by seeing this.
If tooltip shown on the individual item, it could be very useful.
If any budy knows answer , Please reply.
Use the ToolTip class for this. An example in code would be:
ToolTip toolTip = new ToolTip();
toolTip.Show(comboBox1.SelectedItem.ToString(), comboBox1);
You can then tie this code to the comboBox1_SelectedIndexChanged event handler.
NOTE: Your ComboBox name may differ from mine.

How to add a custom selection Handler to a celltable

I want to add a special selection model to the celltable. Basically the function i want to have is to select a row on the table which is located on left side, a corresponding form will pop up on the right side.
I know so many people will use the singleSelectionModel with SelectionChangeHandler.
But there is problem with this method.
For example, if I select row 1 on the table. the form pop up. I close the form by clicking the close-button. Later then, I select the row 1 again, the event is not fired, because it is SelectionChangeHandler. I have to select other row before doing this. This is no good.
So I think there are a few ways to do this:
Make the row deselected right after I select the row.
Use click handler to fire the event ( to pop up the form)
Use other selection model with other selection handler to do this. (I have no ideas about this though)
So my questions are,
Does anyone know what kind of other selection handler I can use for this.
If I use the click handler on celltable, will there be any problem?
I just want to learn more about this. So any ideas will be welcome.
Thanks a lot.
Best Regards.
Use NoSelectionModel. It won't update the table view after the row is selected. That is, even if the same row is selected, the change event is fired.
//Here 'Contact' is the datatype of the record
final NoSelectionModel<Contact> selModel = new NoSelectionModel<Contact>();
selModel.addSelectionChangeHandler(new Handler() {
#Override
public void onSelectionChange(SelectionChangeEvent event) {
Contact clickedObject = selModel.getLastSelectedObject();
GWT.log("Selected " + clickedObject.name);
}
});
table.setSelectionModel(selModel);
I have using cell table in my each project. The better way to just deselect row manually as u mention. and make change css such as selected cell table's row look not changed after selection.

Get Value on a Window with GridPanel using ExtJS

I have a situation here: I have a form field with trigger xtype, what I want to happen on my trigger function is to open a window with a list or grid of data in it. I want to get the value of those data and assign it as the value of my form field with trigger. Can anyone help me solve this problem. Thank you very much.
You have multiple solutions for this.
You can make use Saki's simple message bus to do the communication between extjs components.
You can create an custom event for your trigger field. When user selects a record in your window, fire the event with the selected record.
Inside your onTriggerClick :
Display your window with grid / view for user selection
Inside your Window (on some submit button):
onSubmitClick: function(){
// Get the selected record & fire event
var selected = grid.getSelectionModel().getSelected();
triggerFieldObject.fireEvent('recordSelect',selected);
}
Inside your event processing (Will be on TriggerField):
onRecordSelect: function(record) {
// Now you have access to the selected record.. process it,
// Set the trigger field value etc
this.setValue('Your Value for Trigger Field');
}
Note: This is a skeleton code and not a complete solution. You will need to add your code according to your requirements.

Dojo: dijit.form.select won't fire "onClick" event the first time clicked

I've been through the Dojo docs as well as the API and tried Google but can't find a solution to my problem, I hope anybody here can help me out.
I'm trying to create a dijit.form.select programmatically (using Dojo 1.4) and connect to the "onClick"-event of the widget.
Here's a part of my code:
var dataSelect = new dijit.form.Select({
id : "myselect",
name : "myselect",
labelAttr: "label",
labelType: "html"
},
"selectid");
dataSelect.addOption({value: "value", label: "first item label"});
dojo.connect(dataSelect, "onClick", function() {
alert("clicked!");
});
What it does: A select-box is created replacing an input-field with the ID "selectid", an option "first item label" is created. Everythings all right until here.
Then I connect to the "onClick"-event of the select, which is supposed to load more options via AJAX (but will just display an alert for testing purposes in this example).
The problem: When I click on the little arrow next to the dropdown, the event is fired (OK). But when I click on the select box itself (the area containing the option), the event is NOT fired the first time I click it (unless I clicked on the arrow before).
When I click the select box a second time (and every time after that), the event will fire!
I've tried to use "onFocus" instead of "onClick" which does work, but then the dropdown will not open when first clicked, even if I use the "openDropDown"-function (which does work when connecting to "onClick"!).
Is it me, did I run into a Dojo bug or is it a strange feature I just don't get?
Any help is appreciated.
Greetings,
Select0r
Here is a cross-browser solution:
var sizeSelect = new dijit.form.Select({
id: "sizeSelect",
name: "state",
options: size,
onChange: function(val) {
dojo.style(dojo.byId("textInput"), {"fontSize":val});
}
}, "sizeSelect");
Try to connect not to the widget itself but to it's dom node:
dojo.connect(dataSelect.domNode, "onclick", function() {
alert("clicked!");
});
Select (which extends _HasDropDown) has fancy code to handle:
mouse down on select widget
mouse move to one of the options
mouse up
Maybe that's canceling the click event.
Maybe you can connect to _loadChildren() instead.
The root cause for this issue is that the _onDropDownMouseDown method of dijit._HasDropDown will manipulate the dom node, which cause the e.target of onmousedown and onmouseup changes for the first initialization.
As we know, the onclick event will be triggered only when the target of onmousedown and onmouseup are the same target.
So in this case, the onclick event is not triggered.
It seems that in Dojo 1.5, the problem still remains.