closeAfterEdit not working after editing the form

2019-09-16 16:02发布

问题:

I am using jqgrid and the only issue is Edit form is not closed after editing, whereas Add form and Delete form are closed and reloaded properly. I think I am giving the options order incorrectly but I tried different permutations but no luck. Can anyone give a look at my javascript and provide any suggestions?

$("#person").jqGrid('navGrid', '#personpager', { edit: true, add: true, del: true, search: true },
           { closeAfterEdit:true, reloadAfterSubmit: true },
           { closeAfterAdd:true, reloadAfterSubmit: true },
           { reloadAfterSubmit: true },
           { closeOnEscape:true, multipleSearch: true, closeAfterSearch: true },
           {});

回答1:

this could be a bug in jqGrid version you are using, BTW what is the version you are using...anyways

look at this solution i think this is exactly what you need

jqgrid - close form dialog



回答2:

I just resolved this after trying every place I could possibly add closeAfterEdit: true. I had defined formatoptions in my colModel to open modal for edit; looks like formatoptions.editoptions was the place I needed to set the value:

colModel: [...{
                  name: 'Edit',
                  search: false,
                  width: 60,                  
                  sortable: false,
                  edittype: 'button',
                  formatter: 'actions',
                  formatoptions: {
                      editformbutton: true,
                      editOptions: {
                          **closeAfterEdit: true**
                      },
                      delOptions: {
                          ... 
                          },
                          onclickSubmit: function (params, postdata) {
                              var rowData = $(this).getRowData(postdata);
                              return { TagId: rowData.TagId };
                          }
                      }
                  },
                  title: false
              },