Quantcast
Channel: SmartClient Forums
Viewing all articles
Browse latest Browse all 4756

Close Picklist in the SelectItem when mouseout event is triggered on Picklist

$
0
0
Be sure your post includes:

I am using SmartGWT SmartClient Version: SC_SNAPSHOT-2011-12-05/LGPL Development Only (built 2011-12-05)

I am using FF 25.0.1

I have the following requirement.

There is a select item which has a pickList which is a ListGrid with check boxes for multiple selection. Once the user selects the records then user has to manually click on the picklisticon (down arrow just beside (right) to the select item) or he can click anywhere out side of the select item to close the pickList. Now i want to close this pickList when the mouse moves out of the listGrid (pickList) after user selects the records he wants to. This is because ,after selecting the records there is a button which user clicks to save the form. With Picklist being closed only when he manually clicks the down arrow or anywhere outside of the select item and then click on the apply button.

Is there any way i can achieve this functionality?

Following is the code
Code:

VLayout layout = new VLayout();

final ButtonItem button = new ButtonItem("button","Apply");
            button.addClickHandler(new ClickHandler() {

                @Override
                public void onClick(ClickEvent event) {
                    SC.say("You clicked me");

                }
            });


    final ListGrid pickListProperties = new ListGrid();
            pickListProperties.setShowHeader(true);
            pickListProperties.setCanGroupBy(false);
            pickListProperties.setAutoFetchData(true);
                pickListProperties.addMouseOutHandler(new MouseOutHandler() {

                @Override
                public void onMouseOut(MouseOutEvent event) {
                    GWT.log("Closing the pick list of the select item");
                    pickListProperties.hide(); // Not sure how to get the arrow down item and fire the click event on this so that pickList is closed.
                            button.focusInItem();


                }
            });


            ListGridField descrField = new ListGridField("description","Names");
            DataSourceTextField dsField = new DataSourceTextField("description","Names");
            dsField.setMultiple(true);

            DataSource optionalDS = new DataSource();
            optionalDS.setDataURL(GWT.getModuleBaseForStaticFiles()+"optional.xml");
            optionalDS.setFields(dsField);

            final SelectItem selectItem = new SelectItem("Name","Select");
            selectItem.setPickListHeight(100);
            selectItem.setSelectOnFocus(true);
            selectItem.setPickListFields(descrField);
            selectItem.setPickListProperties(pickListProperties);
            selectItem.setPickListWidth(350);
            selectItem.setOptionDataSource(optionalDS);
            selectItem.setMultiple(true);
            selectItem.setAllowEmptyValue(false);
            selectItem.setMultipleAppearance(MultipleAppearance.PICKLIST);
            // selectItem.sett trigger


            DynamicForm hdf = new DynamicForm();
            hdf.setFields(selectItem,button);
    layout.addMember(hdf);


Viewing all articles
Browse latest Browse all 4756

Trending Articles