jqGrid, how to populate select list from query

前端 未结 7 1511
盖世英雄少女心
盖世英雄少女心 2021-01-02 20:02

I got a basic jqGrid working in my coldfusion project. One of my fields in jqGrid is a combo box. Currently the editoption values are hard coded just like below.

<         


        
7条回答
  •  臣服心动
    2021-01-02 20:43

    Lets say that in your ColModel you have a column like this:

    {name:'id_UDM', index:'id_UDM', width:150, editable:true, edittype:"select", editoptions:{dataUrl:'filename.php'}}
    

    You must first declare that its a select element with this:

    edittype:"select"
    

    Then, in the editoptions parameter add a dataUrl like this:

    editoptions:{dataUrl:'filename.php'}
    

    The filename.php must return a "select" element with it's options, here's an example:

    ';
        while($row = mysql_fetch_array($result1)) {
             $response .= '';
        }
        $response .= '';
    
        echo $response;
    
     mysql_close($db);  
    ?>
    

    Hope this helps.

提交回复
热议问题