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

2 posts, 0 answers
  1. M
    M avatar
    2 posts
    Member since:
    Oct 2016

    Posted 06 Oct Link to this post

    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>

  2. Georgi Krustev
    Admin
    Georgi Krustev avatar
    3707 posts

    Posted 10 Oct Link to this post

    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.
     
  3. Kendo UI is VS 2017 Ready
Back to Top