jqGrid, how to populate select list from query

前端 未结 7 1456
盖世英雄少女心
盖世英雄少女心 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:48

    I adapted the code for searchoptions instead of editoptions. However it was automatically selecting the first option and filtering the list so I added the following to alleviate that.

     $response ='<select>';
     $response .= '<option value=""></option>';
     while($row = $stmt->fetch(PDO::FETCH_NUM)) {
          $response .= '<option value="'.$row[0].'">'.$row[0].'</option>';
     }
     $response .= '</select>';
    
     echo $response;
    
    0 讨论(0)
提交回复
热议问题