0

Although there were several links regarding dynamic dropdown .after using those links i could not get expected result.I am able to get dynamic dropdown from php.But dont know how to pass parameter in editoption.Could any one suggest this.

how to get current row id .i want to pass it as id. in below shown:

Here is the code for jqgrid colmodel:

colModel:[{name:'proof',index:'proof', width:50,formoptions:{rowpos:4, colpos:2},editable:true,edittype:"select",
editoptions: { dataUrl:"http://27.251.54.45/lighthouse/dynamicversion.php?id=" +id}},]

php code:

include("include/connect.php");

$jobid=$_GET['id'];
$query = "SELECT  r.revisionid FROM revision r JOIN revision v
          ON r.versionid = v.versionid and r.jobid=$jobid";


echo "<select id='proof'>
<option value='New Version'>New Version</option>
<option value='New Revision'>New Revision</option>";
$result = mysql_query ($query,$connect);
while($cat=mysql_fetch_array($result)){

        echo "<option value=$cat[0]>$cat[1]</option>";
    }
echo "</select>";
?>

Could any one please give suggestion on this.Thanks

user762641
  • 81
  • 1
  • 7

1 Answers1

1

Firs of all you should never include prefix like http://27.251.54.45/ in the URL used for Ajax requests if you don't use JSONP.

If I understand correctly your problem you should follow my suggestion from the answer and my pull request which is a part of current version of jqGrid. So to solve your problem you should modify editoptions of the column to the following

editoptions: {
    dataUrl: "/lighthouse/dynamicversion.php",
    postData: function (rowid) {
        return { id: rowid };
    }
}
Community
  • 1
  • 1
Oleg
  • 220,925
  • 34
  • 403
  • 798
  • Hi Oleg thank for your quick response .But still i am not getting id being posted in dynamicversion.php.is there any thing else i need to modify – user762641 Apr 22 '13 at 14:42
  • @user762641: You are welcome! Which version of jqGrid you use? – Oleg Apr 22 '13 at 14:45
  • since i m working on maintainence i m not very sure.But most probably it is 4.1.1 – user762641 Apr 22 '13 at 14:47
  • 1
    @user762641: You should upgrade jqGrid to the current jqGrid version 4.4.5 (you can download it [here](http://www.trirand.com/blog/?page_id=6)). [The answer](http://stackoverflow.com/a/14952082/315935) which I referenced says that the feature are implemented starting with 4.4.2 version and then improved in more recent version. – Oleg Apr 22 '13 at 14:58
  • is it not possible to modify only few core files .Because i dont which are old jqgrid files and modified files – user762641 Apr 22 '13 at 15:08
  • 1
    @user762641: It's bad way, but if you want you can follow the changes which I described in [my pull request](https://github.com/tonytomov/jqGrid/commit/3e2a0ada37357e717f17acfcfd0289a7a0800427). Alternatively you can follow [more old answer](http://stackoverflow.com/a/8067258/315935). – Oleg Apr 22 '13 at 15:30
  • Thanks again Oleg.Difficult to imagine Jqgrid without Oleg.For me jqgrid is synomous with oleg – user762641 Apr 23 '13 at 08:51
  • Oleg, this does not work for me either. Jqgrid is a source of much frustration for me - no examples or help available. – sarsnake Jun 13 '16 at 22:22
  • @sarsnake: What you did? **Which version and from which fork of jqGrid you use?** Which examples you want to have? I posted very much demos in my old answer and I develop [free jqGrid](https://github.com/free-jqgrid/jqGrid) fork, which I provide for free. For example `dataUrl` can be function in free jqGrid (see [here](https://github.com/free-jqgrid/jqGrid/blob/v4.13.3/js/grid.common.js#L452)) and `postData` too (see [the line](https://github.com/free-jqgrid/jqGrid/blob/v4.13.3/js/grid.common.js#L455)). – Oleg Jun 13 '16 at 23:00