Adding one more action configuration to this of struts.xml
> From: [email protected]
> To: [email protected]
> Subject: sjg:grid in modal window not getting displayed atall
> Date: Fri, 4 Sep 2015 09:53:36 -0400
>
> I am trying to use sjg:grid in a modal window which is opened from a tabbed
> panel.
>
>
> Have the below code. Everything seams right to me. The modal window opens and
> displays other stuff but the grid is not getting displayed atall. The
> getJSON() in the action class is never getting called.
>
>
> I did similar code in another page and it worked fine. Only difference being
> now I am trying it on the modal window.
>
>
>
> Please need help with this. Not sure what am I missing here.
>
>
>
>
>searchDepartment.jsp....Code
>
> .........
>
> <s:url var="searchResultsUrl" action="grid/searchResultsAJAXAction"/>
>
> <sjg:grid
>
> id="id"
>
> caption="Testing"
>
> dataType="json"
>
> href="%{searchResultsUrl}"
>
> pager="true"
>
> gridModel="searchResults"
>
> rowList="10,15,20"
>
> rowNum="15"
>
> rownumbers="true"
>
> viewrecords="true"
>
> autowidth="true"
>
> navigator="true"
>
> navigatorAdd="false"
>
> navigatorViewOptions="{height:280, width:500}"
>
> navigatorDelete="true"
>
> navigatorDeleteOptions="{height:280,
> width:500,reloadAfterSubmit:true}"
>
> navigatorEdit="false"
>
> navigatorRefresh="true"
>
> navigatorSearch="false"
>
> multiselect="true"
>
> onSelectRowTopics="rowselect"
>
> loadonce="true"
>
> >
>
> <sjg:gridColumn name="deptNumber" index="deptNumber"
> title="Department Number" key="true" sortable="true"/>
>
> <sjg:gridColumn name="deptDescription" index="deptDescription"
> title="Department Description" sortable="false"/>
>
> </sjg:grid>
>
>
>
>
> struts.xml<package name="app_default" extends="struts-default" namespace="/">
<action name="searchDepartment" class="xxx.CreateDepartmentAction">
<result>/jsp/searchDepartment.jsp</result>
<result name="input">searchDepartment</result>
</action>
</package>
>
> <package name="grid-default" extends="struts-default,json-default"
> namespace="/grid">
>
> ..........
>
>
>
> <action name="searchResultsAJAXAction" class="xxx.CreateDepartmentAction">
>
> <result name="success" type="json"></result>
>
> <result name="error" type="json"></result>
>
> </action>
>
>
>
> </package>
>
>
>
>
> Action class
>
> public class CreateDepartmentAction extends ActionSupport implements
> SessionAware {
>
> .................
>
>
>
> private List<Departments> searchResults = new ArrayList<Departments>();
>
> public String execute() {
>
> retrieveSearchDepartmentsResults();
>
>
>
> return SUCCESS;
>
> }
>
>
> public String retrieveSearchDepartmentsResults() {
>
>
>
> try {
>
> setSearchResults(getSearchResultsBasedOnCriteria());
>
> int to = (rows * page);
>
> int from = to - rows;
>
> records = getSearchResults().size();
>
> searchResults = getSearchResults();
>
> total =(int) Math.ceil((double)records / (double)rows);
>
> } catch (Exception e) {
>
> return ERROR;
>
> }
>
> return SUCCESS;
>
> }
>
>
>
> }
>
> .......
>
> getters and setters
>
> ............
>
> public String getJSON()
>
> {
>
> return retrieveSearchDepartmentsResults();
>
> }
>
>
> }
>