Struts 2可编辑网格,想要通过+图标/删除图标添加表单数据时取出网格外的表单值而不是选择属性值

时间:2016-04-07 18:57:00

标签: jquery struts2

我有一个struts 2可编辑网格

<s:url id="attrAssignmentGridUrl"
                        action="populateAttributeAssignmentGrid">
                    </s:url>
                    <s:url id="attrAssignmentEditGridUrl"
                        action="saveOrupdateAttributeAssignment" />
                    <sjg:grid id="attrAssignmentGrid" href="%{attrAssignmentGridUrl}"
                        dataType="json" name="attrAssignmentGrid"
                        formIds="attributeSetupForm"
                        reloadTopics="reloadAttrAssignmentGrid"
                        onSelectRowTopics="attrAssignmentRowSelect" pager="true"
                        rowList="100,500,1000" rowNum="10" rownumbers="false"
                        navigator="true"
                        navigatorRefresh="false"
                        navigatorSearch="false"
                        navigatorAdd="true"
                        navigatorAddOptions="{height:280,reloadAfterSubmit:true}"
                        navigatorEdit="true"
                        navigatorEditOptions="{height:280,reloadAfterSubmit:false}"
                        navigatorView="false"
                        navigatorDelete="true"
                        navigatorDeleteOptions="{height:280,reloadAfterSubmit:true}"
                        gridModel="attributeAssignmentList" gridview="true"
                        editinline="true" editurl="%{attrAssignmentEditGridUrl}"
                        viewrecords="true" onEditInlineSuccessTopics="oneditsuccess"
                        requestType="post" onPagingTopics="pagingAttrAssignmentGrid">

                        <sjg:gridColumn name="ownerId" index="ownerId"
                            id="ownerId" editable="true" title="Owner Id" align="center"
                            sortable="false" edittype="text" search="false" width="150" />

                        <sjg:gridColumn name="assetId" index="assetId"
                            id="assetId" title="Asset Id" align="center" editable="true"
                            sortable="false" edittype="text" search="false" width="150" />

                        <sjg:gridColumn name="value" index="value"
                            id="value" title="Value" align="center" editable="true"
                            sortable="false" edittype="text" search="false" width="150" />

                        <sjg:gridColumn name="createdBy"
                            index="createdBy" id="createdBy" title="Created By"
                            align="center" editable="true" sortable="false" edittype="text"
                            search="false" width="150" />

                        <sjg:gridColumn name="lastUpdatedBy"
                            index="lastUpdatedBy" id="grdlastUpdatedBy"
                            title="Last Updated By" align="center" sortable="false"
                            editable="true" edittype="text" search="false" width="150" />

                        <sjg:gridColumn name="assignmentId"
                            index="grdassignmentId" id="grdassignmentId"
                            title="Assignment Id" align="center" sortable="false"
                            editable="true" edittype="text" search="false" width="150" hidden="true"/>

                        <sjg:gridColumn name="attributeId"
                            index="grdattributeId" id="grdattributeId"
                            title="Attribute Id" align="center" sortable="false"
                            editable="true" edittype="text" search="false" width="150" hidden="true"/>

                        <sjg:gridColumn name="attributeTypeId"
                            index="grdattributeTypeId" id="grdattributeTypeId"
                            title="Attribute Type Id" align="center" sortable="false"
                            editable="true" edittype="text" search="false" width="150" hidden="true"/>

                    </sjg:grid>

当我们点击网格底部栏中的+图标,打开表格输入网格数据并保存时,我想要另外2个下拉值

<s:url id="attributeTypeUrl" action="getAttributeTypesList" />
                        <sj:select id="selectedAttributeType" name="selectedAttributeType"
                            href="%{attributeTypeUrl}" dataType="json"
                            formIds="attributeSetupForm" onChangeTopics="reloadAttributeList"
                            reloadTopics="reloadAttributeTypeList" requiredPosition="left"
                            labelposition="left" headerKey="0"
                            headerValue="Add Attribute Type" listKey="typeIdStr"
                            listValue="displayName" list="attributeTypeList"
                            onchange="displayAttribute()" cssStyle="width: 300px;" />


<sj:select id="selectedAttribute" name="selectedAttribute"
                            href="%{attributeUrl}" dataType="json"
                            formIds="attributeSetupForm" requiredPosition="left"
                            labelposition="left" headerKey="0" headerValue="Add Attribute"
                            listKey="attributeIdStr" listValue="displayName"
                            onChangeTopics="reloadAttrAssignmentGrid" onCompleteTopics="loadCompleteAttributeList"
                            reloadTopics="reloadAttributeList" list="attributeList"
                            onchange="displayAttributeAssignment()" cssStyle="width: 300px;" />
当我输入editURL的action方法时,

selectedAttributeType和selectedAttribute已填充。截至目前,它是空的。我如何将其带到我的行动中?

1 个答案:

答案 0 :(得分:0)

谢谢大家。我尝试使用变量,但没有任何效果。让我工作的是,设置会话变量并访问编辑URL。希望它能帮助正在寻找解决方案的任何人。