This is a migrated thread and some comments may be shown as answers.

Cascading Combo box passing parameter to action class(struts2 java)

1 Answer 16 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
M
Top achievements
Rank 1
M asked on 06 Oct 2016, 10:30 AM

Hi All,

 

Im trying to pass parameter from combo box to action class. below is my cascading combo box. how can i get value of first combo box to action class to get list values to second combo box. i have created companyId(Long) setter and getter in action class but its always coming as value 1. please help me how to pass the value of first combo box to action class. below is my snipet.

 

 <kendo:comboBox  name="companyId" filter="contains" placeholder="Select company..." style="width: 50%;" suggest="true" dataTextField="unitName" dataValueField="id">
                  <kendo:dataSource data="${organizationUnitsList}"></kendo:dataSource>
     </kendo:comboBox>
    
      <label for="payGpName">Pay Group Name:</label>
     <kendo:comboBox  name="payGpName" filter="contains" placeholder="Select company..." style="width: 50%;" suggest="true" autoBind="false" cascadeFrom="companyId" dataTextField="payGpName" dataValueField="id">
                 <kendo:dataSource serverFiltering="false">
                <kendo:dataSource-transport>
                   <kendo:dataSource-transport-read url="/reports/misreports/loadPayGroup" type="POST" contentType="application/json"/>
                   <kendo:dataSource-transport-parameterMap>
                        <script>
                            function parameterMap(options,type) {
                                return JSON.stringify(options);
                            }
                        </script>
                    </kendo:dataSource-transport-parameterMap>
                </kendo:dataSource-transport>
            </kendo:dataSource>
     </kendo:comboBox>

1 Answer, 1 is accepted

Sort by
0
Georgi Krustev
Telerik team
answered on 10 Oct 2016, 08:52 AM
Hello лю,

The best way to get the value of the parent widget is to use JavaScript. For instance, you can retrieve `companyId` dropdownlist and get its value using the available API:

http://docs.telerik.com/kendo-ui/api/javascript/ui/dropdownlist#methods-value

<script>
  function parameterMap(options,type) {
     var companyIdWidget = $("#companyId").data("kendoDropDownList");
 
     alert(companyIdWidget.value());
 
     return JSON.stringify(options);
  }
</script>

Regards,
Georgi Krustev
Telerik by Progress
 
Get started with Kendo UI in days. Online training courses help you quickly implement components into your apps.
 
Tags
ComboBox
Asked by
M
Top achievements
Rank 1
Answers by
Georgi Krustev
Telerik team
Share this question
or