tags:

views:

322

answers:

2

Hello, I am working to an application that uses jqgrid. The problem is that the edit dialog that should appear at row edit must have a specific layout. So i would prefer to load it via ajax and then send the data back to jqgrid. I searched a lot on the forums but i could not find an example on how to do it.

So, i just need jqgrid to fill the edit dialog popup with custom content from a php script.

Thank you.

UPDATE: THe ideea is that i have a form generator, where the user sets the position/width/heigh/visibility of the edit fields... and this must be used in the edit dialog

A: 

You can check this Tutorial, which is the official demo website of jqGrid Plugin. I am sure that there are examples of some "Row Editing" in that category. You can view lots of other examples of jqGrid also, in this demo website.
You can also check the Home page.

If you have any more problems, you can ask it here. I did use some of those examples in one of my client's (confidential) website, so it will be easy to manipulate according to your needs.

Hope it helps.

Knowledge Craving
Thanks, but i all ready looked over them. What i need is a custom edit dialog, that has nothing to do with the fields in the grid. The edit row should send me the row id and i will return the HTML and JS code that will be shown in the dialog.
Andrei
@Andrei - Have you checked all the 5 examples in "Row Editing" category? There are code snippets also in there, below each of the examples in the right panel.
Knowledge Craving
+1  A: 

You can use editfunc or addfunc option of the navGrid. If for example editfunc are defined then instead of editGridRow jqGrid will be called editfunc with the id of selected row as the parameter.

Alternative you can use custom button (see this answer as an example).

To modify data in the table after ther custom edit dialog you can use setRowData function.

UPDATED: If you need just make some modification of layout of the edit dialog you can use beforeShowForm for th modifications.

Oleg
thanks, but it seems it is not working :(, i tried like this: ...).navGrid('#navId', {edit:true},{ editfunc: function(id){ alert(id); }, height:600, reloadAfterSubmit:false, jqModal:true, closeOnEscape:true });
Andrei
@Andrei: in this way it can not work `editfunc` or `addfunc` are option of `navGrid` and **NOT** a part of `prmEdit` parameter. So you should try `...).navGrid('#navId', {edit:true, editfunc: function(id){ alert(id); }});`
Oleg
Thanks, it works great!
Andrei