0

I have a jqGrid. At the footer of it there are 3 default icons for Add, Delete and Edit records(They are not for inline edit/add/delete). I have created a html navigation bar and in that bar I have placed 3 button named Add, Edit and Delete. I want to mentioned that this edit/add/delete operation has some complex options. That means they are not normal delete/edit operation. That's why I have created the add,delete,edit options separately and placed them as a reference in my pager section like below.

navGrid(
    '#gridPager', {
        view: true,
        add: true,
        edit: true,
        del: true,
        search: true,
        closeOnEscape:true
    }, editParams,  // default settings for edit
       newParams, // default settings for add
       deleteParams , ....

After that I have added click event to my customized buttons -

$("#editButton").click(function() {
var gr = jQuery("#gridTable").jqGrid('getGridParam', 'selrow');
alert(gr);
if (gr != null)
    jQuery("#gridTable").jqGrid('editGridRow', gr, editParams);
else
    alert("Please Select Row");
})

Now the problem is. When using both the edit buttons i'm finding that they are not working perfectly. Am I missing something or doing anything wrong. Any suggestion will be helpful for me.

Please have a look on the attached image for getting an idea what I'm trying to achieve.

Screenshot of the grid that I'm trying to build

Community
  • 1
  • 1
ifti24
  • 191
  • 1
  • 5
  • 22
  • You wrote just "When using both the edit buttons i'm finding that they are not working perfectly". What problem exactly you have? Moreover you don't posted *your implementation*. I don't understand too why **both** buttons you need. If you like standard editing buttons why you not just use `toppager: true` jqGrid option and `cloneToTop: true` option of `navGrid`? It will create top and bottom pagers with the same standard buttons. – Oleg Oct 14 '14 at 10:16
  • 1
    By the way the options of `navGrid` can be reduced to `.navGrid("#gridPager", {view: true}, ...);`. See [documentation](http://www.trirand.com/jqgridwiki/doku.php?id=wiki:navigator). If you use in many case the same "default settings" for Add/Edit/Delete and `navGrid` then you can modify `$.jgrid.edit`, `$.jgrid.del`, `$.jgrid.view`, `$.jgrid.search` and `$.jgrid.nav` by code like `$.extend($.jgrid.nav, {view: true, cloneToTop: true});` and use simplest form of `navGrid` call: `$("#grid").navGrid("#gridPager");` – Oleg Oct 14 '14 at 10:25
  • Hi Oleg, thanks for your comments. And obviously it is helpful to use a common setting by using the extend pattern. anyway, do u have any suggestion for my current case? I would also like to get some idea from you about an past issue - http://stackoverflow.com/questions/26328548/jqgrid-select-box-value-formatter-issue – ifti24 Oct 14 '14 at 10:49
  • Sorry, but you don't answered on the questions from my first comment. I can't help you because I don't understand your problem. About your [another question](http://stackoverflow.com/questions/26328548/jqgrid-select-box-value-formatter-issue): I don't full understand what you need. Why you not just use `formatter: "select"` with optional `cellattr` to set the color of the cell additionally which changes color/background of the cell with "Inactive"? – Oleg Oct 14 '14 at 10:59
  • @ Oleg: I would like to share my .js file with you. But that file is very much long and sharing it here will not be a good idea I think. How can I send the js file to you ? – ifti24 Oct 14 '14 at 15:47
  • @Oleg: I don't know why you are so great. Can you please write your comments here - http://stackoverflow.com/questions/26328548/jqgrid-select-box-value-formatter-issue . Your suggestion solve my problem. Please provide your answer there. I'm going to accept it there. Thanks again for your kind and continuous support. – ifti24 Oct 15 '14 at 10:32
  • You are welcome! I posted the answer. – Oleg Oct 15 '14 at 10:50

1 Answers1

0

I solved the problem by adding the following configuration -

$.extend($.jgrid.edit, { recreateForm: true });

Now both the default edit button and custom edit button works perfectly.

ifti24
  • 191
  • 1
  • 5
  • 22