当我单击“删除行”按钮时,它会调用我的 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"/>