In GWT need to set the value of list box to the one,that was was selected in other selection - gwt

I have a full search panel with listbox whose value are read from DB.when a item in listbox selected and search is made.If the results are not found the search panel is condensed (one more search panel) and in condensed search ,we can change the search criteria ,selected a different item in the list box .after changing the search criteria and if search is made ,when the full search panel appears,the value of the list box in full search panel should be same as the one changed/selected in the condensed search panel.
How can we accomplish this.
In simple - If i have two list boxes, load a list box and set the value of the listbox same the other listbox.If value of one listbox is changed, the other should be changed and the value of this listbox is set with the value selected in the previous one.

I would do the following
//you have something like this
ListBox listbox1;
ListBox listbox2;
//add a change handler
listbox1.addChangeHandler(new ChangeHandler() {
#Override
public void onChange(ChangeEvent event)
{
int index = listbox1.getSelectedIndex();
//do your update code here for listbox2
//like a listbox2.setSelectedIndex(index) or something
}

As far as I see its an easy implementation. Add a value change handler on the first listbox and do whatever you want in onChange method.
Regarding your panel need to be collapsed when there is no search results, you can always use vertical panel and set its height to 100% and add another panel to it or Use Dock Panel and add panels to south or best use disclosure panel and play around with it.

Related

Ag-Grid expand row

Im using Ag-grid to control my table, but i want in my group that stores a list of rows instead of having to make the row group expand in 2 clicks, i want to be on 1 click.
If i click on the icon arrow it works, but if i click on the title row it only opens on 2 clicks.
I already tried to find in the documentation any information about it, but cant find nothing.
Here is a example from the documentation.
https://ag-grid.com/javascript-grid-tree/index.php
example image:
We are now recommended not to use the onGroupExpandedOrCollapsed, so this should now be...
This will also update the icons and animate the rows, which onGroupExpandedOrCollapsed won't.
onRowClicked(params) {
params.node.setExpanded(!params.node.expanded);
}
This will toggle the expansion, use params.node.setExpanded(true) if you want the rows to just stay open.
You can listen to events on either a row or cell clicked, and expand nodes accordingly.
For example to expand a row based on a click you could do the following:
onRowClicked: (params) => {
// update the node to be expanded
params.node.expanded = true;
// tell the grid to redraw based on state of nodes expanded state
gridOptions.api.onGroupExpandedOrCollapsed(params.rowIndex)
}
This should be in the documentation - I'll update it to reflect this information.
In the column definition, you can use the onCellClicked(params) function to tell it to do something when the cell is clicked. I tried looking for an expand function, but I could only find expandAll() which I don't think you will want. So what I would do is just use jquery or simple DOM selection to click on the expand icon inside of that cell.
this one works
onRowClicked(params) {
params.context.setExpand.onExpandClicked(params.rowIndex, params.node.rowHeight);
}

Disable JFace TableViwer single row

Does anyone know how to disable a single row of a JFace TableViwer? I have a TableViwer constructed as follows:
TableViwer tv = new TableViwer(composite, SWT.NONE| SWT.FULL_SELECTION | SWT.BORDER);
tv can have many rows, but I am adding a particular unique row to the table dynamically(when an external button is clicked) and I need to make only that row disabled (grayed out and not selectable. Not selectable can also be achieved through existing handler, if there is no other option).
I searched in google but did not get much information. I am new to SWT/JFace, so any help would be appreciated.
You would have to do something in the selection listener to reject selection of the row.
To make the row gray you can make your Label Provider implement IColorProvider which lets you define the two methods:
public Color getForeground(Object element);
public Color getBackground(Object element);
which can color the row.
You could also use a label provider derived from StyledCellLabelProvider which lets you define more complex coloring.

Infopath: Rules with Multiple Selection List Box do not trigger

Im trying to implement several rules for a form, based on a selection of some multiple selection list boxes. Im customizing a form for a existing SharePoint list by clicking on "Customize Form" in SharePoint. First of all, the choice fields on the list (multiple selection) are oddly binded in InfoPath:
I cant change the variable's name "Value" and Real Estate Categories should not be a required field. (*)
On one view I have a "Business Unit Purchase" box that is a multiple selection box (choice) and there is a next button. The next button should only be availiable when a selection is made.
So I tried to the following rules for the Next Button:
Rule Type Action:
IF Value (of Business Unit Pruchase) is not blank -> Switch to next view
This works properly, but now i wanted to disable the next button when nothing is the text box was selected, because it makes it more clear to have a selection beofre ist possible to go on. So I tried this:
Rule Type Formatting:
IF Value is blank -> disable this control
This disables the button as wanted when the multiple text box has not any items selected, but after selecting one or more, nothing happens. Is there any reason why this does not work?
Normally when a selection is made, the field "value" of "Business Unit Purchase" should contain one or more strings and therefor should not be blank anymore.
A multiselect list box almost always contains one blank element entry unless it has been manually removed (e.g. via code).
Because of this, the condition Value is blank will almost always be true.
To remedy this, use the dropdown in the Condition builder's field selection dialog to set up your condition as:
All occurrences of Value are blank -> Disable this control
If you do this, the control should be enabled when one or more items are selected.

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.

Eclipse jface tableviewer - changing celleditor at runtime

I am using a Table Viewer with cell editors... one is a ComboxBox and the other one is a textcell editor... At runtime based on the selection in the combo box i want to change the other cell editor to either a texteditor or combobox... How can this be achieved??
When you make selection in one comobox editor, you update the underlying model element with the selection in combobox editor. You get the same element in below method getCellEditor(Object element). Depending on state of the element, you should either return TextCellEditor or ComboBoxCellEditor
org.eclipse.jface.viewers.EditingSupport
org.eclipse.jface.viewers.EditingSupport.getCellEditor(Object element)
you find lot of help online about how to use EditingSupport on TableViewer/TreeViewer