当我点击“删除行”按钮时,它会调用我的jquery函数,但它不会删除我的行。 (请参阅下面的代码)。我想我无法使用自定义按钮获取row_id。这就是我无法删除的原因。我不知道解决方案是什么。
<script type="text/javascript">
$.subscribe('rowdelete', function(event,data) {
alert("function is calling on the delte button click");
$("#gridtable").jqGrid('delGridRow',"row_id_s", {height:200,reloadAfterSubmit:true});
});
</script>
<br/>
<sj:submit id="grid_edit_addbutton" value="Add Row" onClickTopics="rowadd" button="true"/>
<sj:submit id="del_gridtable" value="delete Row" onClickTopics="rowdelete" button="true"/>
<sjg:grid
id="gridtable"
caption="List of Subject Details"
dataType="json"
href="%{remoteurl}"
pager="true"
gridModel="gridModel"
onClickGroupTopics="rowadd,rowdelete">
<sjg:gridColumn name="id" index="subjectId" title="ID" formatter="integer" sortable="true" key="true" search="false" editable="true" hidden="true" />
<sjg:gridColumn name="subjectName" index="subjectName" title="Subject Name" sortable="true" search="true" editable="true" edittype="text" />
</sjg:grid>
<script type="text/javascript">
$.subscribe('rowdelete', function(event,data) {
alert("function is calling on the delte button click");
$("#gridtable").jqGrid('delGridRow',"row_id_s",{height:200,reloadAfterSubmit:true});
});
</script>
<br/>
<sj:submit id="grid_edit_addbutton" value="Add Row" onClickTopics="rowadd" button="true"/>
<sj:submit id="del_gridtable" value="delete Row" onClickTopics="rowdelete" button="true"/>
答案 0 :(得分:0)
您可以将id放在PROPERTY标记中,当您单击按钮时刷新datagrid(通过执行ex的操作或刷新包含它的div)