I am using the search toolbar and I have all of the features working except I cannot figure out how to pass the values from one dropdown box to the server page to narrow the returned items in the dropdown list. When something has been selected for field I want it to narrow down the list of well names in the other dropdown box to only those available in that field.
I was hoping the post option would be active and pass the field automatically, but of course it could not be that simple. I’m guessing this needs tied to an event but have not been be able to find any examples.
Â
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
     <br /> // <![CDATA[<br /> <br />       jQuery(document).ready(function()<br />       { jQuery("#grid").jqGrid({<br />             url: "getinfo.php",<br />             datatype: "json",<br />             mtype: 'POST',<br />             autowidth: true,<br />             height: 330,<br />             colNames: ["Name", "Num", "Field", "Pad", "API", "Legal", "County, State",<br />                "Lease", "Unit CA PA", "Status", "Updated", "Wildlife Stips", "Notes"],<br />             colModel: [<br />                { name: "well_name", width: 48,sortable: true, search:true, stype:'select', searchoptions: {dataUrl:'selectwell.php'}},<br />                { name: "well_num", width: 18,sortable: true, search:true, stype:'text'},<br />                { name: "field", width: 48,sortable: true, search:true, stype:'select', stype: 'select', searchoptions: {dataUrl:'selectfield.php'}},<br />                { name: "pad", width: 36,sortable: true, stype:'text'},<br />                ...<br />             ],<br />             rowNum:10,<br />             rowList:[10,25,50,10000],<br />             pager : '#pager',<br />             sortname: 'field',<br />             viewrecords: true,<br />             rownumbers: true,<br />             gridview: true,<br />             sortorder: "asc",<br />             caption:"Master Well List Maintenance"<br />          });<br />          jQuery("#grid").jqGrid('navGrid','#pager',<br />          {<br />             view: true,<br />             del: false,<br />             add: true,<br />             edit: true,<br />             search: false,<br />             refresh: true<br />          },<br />          { /*prmEdit*/ },<br />          { /*prmAdd*/ },<br />          { /*prmDel*/ } ,<br />          {<br />             /*prmSearch*/<br />             multipleSearch:true<br />          },<br />          { /*prmView*/ }<br />          );<br />          $('#grid').jqGrid('filterToolbar', { searchOnEnter: true, enableClear: true });<br />          $('#grid').jqGrid('navButtonAdd', '#pager', {<br />                caption: "",<br />                title: "Toggle Search Toolbar",<br />                buttonicon: 'ui-icon-search',<br />                onClickButton: function () {<br />                    this.toggleToolbar();<br />                    if ($.isFunction(this.p._complete)) {<br />                        if ($('.ui-search-toolbar', this.grid.hDiv).is(':visible'))<br />                   {<br />                      <br />                            $('.ui-search-toolbar', this.grid.fhDiv).show();<br />                        } else {<br />                            $('.ui-search-toolbar', this.grid.fhDiv).hide();<br />                        }<br />                        this.p._complete.call(this);<br />                        fixPositionsOfFrozenDivs.call(this);<br />                    }<br />                }<br />            });<br />          $('.ui-search-toolbar').hide();<br />       });<br />        <br /> // ]]><br /> |
Â
Server code…
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
<!--?php <br />include("../Includes/aedclass.php");<br /> $nconn = new WorkData();<br /> $conn = new PDO ($nconn->DB_DSN,$nconn->DB_USER,$nconn->DB_PASSWORD);<br /> <br /> $field = $_POST;<br /> <br /> if (strlen($field)>0)<br /> { $sql = "SELECT field FROM master_well_list WHERE field='$field' GROUP BY field ORDER BY field asc;"; }<br /> else<br /> { $sql = "SELECT field FROM master_well_list GROUP BY field ORDER BY field asc;"; }<br /> <br /> $stmt = $conn->prepare($sql);<br /> $stmt->execute();<br /> <br /> $response ='';<br /> $response .= '<br /> <br /> ';<br /> while($row = $stmt->fetch(PDO::FETCH_NUM)) {<br /> Â Â Â $response .= '<br /> '.$row[0].'<br /> ';<br /> }<br /> $response .= '';<br /> <br /> echo $response;<br /> <br /> ?> |
Copyright 2014 TriRand LtdAll Rights ReservedRSS
Back to Top