0

私のjspページには、x、yと呼ばれる2つのstrut2 Jquery autocompleterボックスがあります。x を変更すると、選択した x の値に応じて自動的に y も変更されます。struts dojo タグでは、トピックをリッスンしてリロードしました。しかし、strut2 jquery はリロードできません。

私のコード

             <sj:autocompleter
                id="mapNameList"
                name="map_name"
                list="%{mapNameList}"
                selectBox="true"
                selectBoxIcon="true"
                onChangeTopics="autocompleteChange"
                onFocusTopics="autocompleteFocus"
                onSelectTopics="autocompleteSelect"
                />
        <label for="map_type">MapType: </label>
            <sj:autocompleter
                id="mapTypeList"
                name="map_type"
                list="%{mapTypeList}"
                selectBox="true"
                selectBoxIcon="true"
                onChangeTopics="autocompleteChange"
                onFocusTopics="autocompleteFocus"
                onSelectTopics="autocompleteSelect"
                />
4

1 に答える 1

0

json autocompleter をリストしたい場合は、次のことができます。

最初のonSelectTopicsを次のような特定の値に定義します

onSelectTopics="/mapNameListChange"

秒を定義する

listenTopics="/mapNameListChange"

次のような関数を作成します。

$.subscribe("/mapNameListChange",function(event, data){
            //clear the children autocompleters
            jQuery('#mapTypeList').val("");
            jQuery('#mapTypeList_widget').val("");
            var ui = event.originalEvent.ui;
            if (ui.item && ui.item.value.length > 0) {
                setJQueryAutocompleterURL(jQuery('#mapTypeList_widget'),"your json request", "extraparameter=" + ui.item.value, "the list used in the json", "mapTypeList", "map_type", "/mapNameListChange", "/mapTypeListChange");
            };
        },null);

setJQueryAutocompleterURL は別の関数です

function setJQueryAutocompleterURL(widget,href, hrefparameter, list, id, name, selectTopics, listenTopics) {

        var options_auto_iban_widget = {};
        options_auto_iban_widget.hiddenid = "mapTypeList";
        options_auto_iban_widget.selectBox = true;
            options_auto_iban_widget.selectBoxIcon= true;
        options_auto_iban_widget.forceValidOption = true;
        options_auto_iban_widget.onselecttopics = "/autoDebtorIbanChange";
        options_auto_iban_widget.list = list;
        options_auto_iban_widget.listkey = "id";
        options_auto_iban_widget.listvalue = "name";
        options_auto_iban_widget.jqueryaction = "autocompleter";
        options_auto_iban_widget.id = id;
        options_auto_iban_widget.name = name + "_widget";
        options_auto_iban_widget.href = href+"?"+hrefparameter;
        options_auto_iban_widget.listentopics = "/autoDebtorBicChange"; 
        jQuery.struts2_jquery_ui.bind(widget,options_auto_iban_widget);
    }

次に、結果をフィルタリングするためのjson呼び出しのパラメーターとして取得する追加パラメーターがあります。

于 2013-10-10T16:24:40.900 に答える