private DropDownChoice<SelectedTrackProfileVO>
savedReportsDropDown;savedReportsDropDown = new
DropDownChoice<SelectedTrackProfileVO>("profileDropDown",savedReportsDropDownList);
savedReportsDropDown.setChoiceRenderer(new
ChoiceRenderer<SelectedTrackProfileVO>("reportName", "cstmReportId"));
savedReportsDropDown.setOutputMarkupId(true);
savedReportsDropDown.setOutputMarkupPlaceholderTag(true);
savedReportsDropDown.add(new AjaxFormComponentUpdatingBehavior("onchange"){

   
    private static final long serialVersionUID = 1L;

    @Override
    protected void onUpdate(AjaxRequestTarget target) {
       
        try {
             TrackingProfileVO trackingProfileVOFromDB = gets the value from
DB.
             
            
trackingProfileVO.setReportLabel(trackingProfileVOFromDB.getReportLabel());
            
trackingProfileVO.setProfileDesc(trackingProfileVOFromDB.getProfileDesc());
            
trackingProfileVO.setShipmentSearch(trackingProfileVOFromDB.getShipmentSearch());
             trackingProfileVO.getLstSelectedSHVReportColumn().clear();
            
trackingProfileVO.getLstSelectedSHVReportColumn().addAll(trackingProfileVOFromDB.getLstSelectedSHVReportColumn());
             trackingProfileVO.getSortFirstColumnList().clear();
             trackingProfileVO.getSortSecondColumnList().clear();
             trackingProfileVO.getSortThirdColumnList().clear();
            
trackingProfileVO.getSortFirstColumnList().addAll(trackingProfileVOFromDB.getLstSelectedSHVReportColumn());
            
trackingProfileVO.getSortSecondColumnList().addAll(trackingProfileVOFromDB.getLstSelectedSHVReportColumn());
            
trackingProfileVO.getSortThirdColumnList().addAll(trackingProfileVOFromDB.getLstSelectedSHVReportColumn());
            
trackingProfileVO.setShareFlag(trackingProfileVOFromDB.isShareFlag());
             shareFlag.setDefaultModel(new
Model<Boolean>(trackingProfileVOFromDB.isShareFlag()));
             if(trackingProfileVOFromDB.getResultsPerPage() != null){
                
trackingProfileVO.setResultsPerPage(trackingProfileVOFromDB.getResultsPerPage());
                 resultsPerPage.setModel(new
Model<DDChoice>(trackingProfileVOFromDB.getResultsPerPage()));
             }
            
trackingProfileVO.getLstSHVReportColumn().removeAll(trackingProfileVOFromDB.getLstSelectedSHVReportColumn());
             
             
            
displaySortingPanel.getSortFirst().setChoices(trackingProfileVOFromDB.getLstSelectedSHVReportColumn());
            
displaySortingPanel.getSortSecond().setChoices(trackingProfileVOFromDB.getLstSelectedSHVReportColumn());
            
displaySortingPanel.getSortThird().setChoices(trackingProfileVOFromDB.getLstSelectedSHVReportColumn());
            
trackingProfileVO.setSortFirst(trackingProfileVOFromDB.getSortFirst());
            
trackingProfileVO.setSortSecond(trackingProfileVOFromDB.getSortSecond());
            
trackingProfileVO.setSortThird(trackingProfileVOFromDB.getSortThird());
             displaySortingPanel.getSortFirst().setDefaultModel(new
Model<SHVReportColumnGridVO>(trackingProfileVO.getSortFirst()));
             displaySortingPanel.getSortSecond().setDefaultModel(new
Model<SHVReportColumnGridVO>(trackingProfileVO.getSortSecond()));
             displaySortingPanel.getSortThird().setDefaultModel(new
Model<SHVReportColumnGridVO>(trackingProfileVO.getSortThird()));
             displaySortingPanel.setDefaultModel(new
Model<TrackingProfileVO>(trackingProfileVO));
             target.appendJavascript("Ricola.init( '#" +
displaySortingPanel.getMarkupId()+ "' );");
             
             target.appendJavascript("Ricola.init( '#" +
displaySortingPanel.getSortFirst().getMarkupId()+ "' );");
             target.appendJavascript("Ricola.init( '#" +
displaySortingPanel.getSortSecond().getMarkupId()+ "' );");
             target.appendJavascript("Ricola.init( '#" +
displaySortingPanel.getSortThird().getMarkupId()+ "' );");
             
             target.addComponent(displaySortingPanel.getSortFirst());
             target.addComponent(displaySortingPanel.getSortSecond());
             target.addComponent(displaySortingPanel.getSortThird());

             target.addComponent(displaySortingPanel);
             target.addComponent(form);
        } catch (SHVServiceException e) {
            
                LOG.error("createSavedReportsDropDown() : Exception",e);
        }
        
        
    }
    
    @Override
    protected IAjaxCallDecorator getAjaxCallDecorator() {

        return new AjaxCallDecorator() {
            private static final long serialVersionUID = 1L;

            @Override
            public CharSequence decorateScript(CharSequence script) {
                
                    final StringBuffer scriptBuffer = new StringBuffer();
                   
scriptBuffer.append("Ricola.page.showPleaseWait('Processing');");
                    scriptBuffer.append(script);
                    return scriptBuffer.toString();
                
            }
        };
        
    }
    
});

-----
Thanks & Regards,
Archana
--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/DropDownChoice-updates-onchange-event-tp3699271p3699847.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org

Reply via email to