I will throw out there VERY honestly – I am not new to coding, but I am clueless when it comes to javascript, jquery, and ajax. Still I have been able to get everything functioning and working that I need. I have mixed and matched a lot of code to get everything working I need.
Here is the problem, I am using a grid as a sub grid, and the first sub grid I need to edit, add, and delete content. Well I can only ‘select’ the bottom row of data. I’m sure I have something in the wrong place, or an extra closing parenthesis or brace etc. However I have not been able to locate it. I can hover over the other rows, and it shows when I change from one row to the next, but I cannot ‘select’ them. Even when I ‘view records’ etc and click the forward and back arrows, it does not go forward and backwards. It stays on the single record (bottom). (I have been through this w/ a fine tooth comb, multiple times, everything has a made, everything ‘works’ where it is placed, etc…)
Â
|
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 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 |
   <!--jquery start datagrid components--><br />    <link rel="stylesheet" type="text/css" href="/Includes/jqgrid/css/jquery-ui.css"/><br />    <link rel="stylesheet" type="text/css" href="/Includes/jqgrid/src/css/ui.jqgrid.css"/><br />    <script type="text/javascript" src="/Includes/jqgrid/js/jquery-1.11.0.min.js"></script><br />    <script type="text/javascript" src="/Includes/jqgrid/js/i18n/grid.locale-en.js"></script><br />    <script type="text/javascript" src="/Includes/jqgrid/js/jquery.jqGrid.src.js"></script><br />    <script type="text/javascript" src="/Includes/tinymce/tinymce.min.js"></script><br />    <script type="text/javascript" src="/Includes/tinymce/jquery.tinymce.min.js"></script><br />    <script type="text/javascript"><br />       jQuery(document).ready(function()<br />       { jQuery("#grid").jqGrid(<br />          {<br />             //main grid<br />             url: "getwellinfo.php",<br />             datatype: "json",<br />             mtype: 'POST',<br />             autowidth: true,<br />             height: 'auto',<br />             colNames: ["Name", "Num", "Field", "Pad", "API", "County, State",<br />                "Status", "Updated", "Wildlife Stips", "Notes"],<br />             colModel:<br />             [<br />                { name: "well_name", index: "well_name", width: 48,sortable: true, search:true, stype:'text'},<br />                { name: "well_num", index: "well_num", width: 18,sortable: true, search:true, stype:'text'},<br />                { name: "field", width: 48,sortable: true, search:true, stype:'select', stype: 'select',<br />                   searchoptions: {dataUrl:'selectfield.php'}},<br />                { name: "pad", index: "pad", width: 36,sortable: true, stype:'text'},<br />                { name: "api", width: 32,sortable: true, search:true, stype:'text',key:true},<br />                { name: "county_state", width: 40, sortable: false, search:false},<br />                { name: "status", width: 27, sortable: false, search:false},<br />                { name: "status_date", width: 22, sortable: false, search:false},<br />                { name: "wildlife_stips", width: 75, sortable: false, search:false},<br />                { name: "notes", width: 75, sortable: false, search:false}<br />             ],<br />             rowNum:20,<br />             rowList:[20,50,100,10000],<br />             pager : '#pager',<br />             viewrecords: true,<br />             rownumbers: true,<br />             sortname: 'field',<br />             sortorder: "asc",<br />             caption:".",<br />             subGrid: true,<br />             subGridRowExpanded: function(subgrid_id, row_id)<br />             {<br />                var subgrid_table_id, subgrid_table_id2, pager_id;<br />                subgrid_table_id = subgrid_id+"_t";<br />                subgrid_table_id2 = subgrid_id+"_t2";<br />                // configuring add options<br />                pager_id = "p_"+subgrid_table_id;<br />                //first grid as sub grid - with editing (add edit delete)<br />                $("#"+subgrid_id).html("<table id='"+subgrid_table_id+"' class='scroll'></table><div id='"+pager_id+"' class='scroll'></div>");<br />                jQuery("#"+subgrid_table_id).jqGrid(<br />                {<br />                   url:"getwellnotes.php?api="+row_id,<br />                   datatype: "json",<br />                   mtype: 'POST',<br />                   autowidth: true,<br />                   colNames: ,<br />                   colModel:<br />                   [<br />                      {name:"Last",width:28,key:true},<br />                      {name:"First",width:28},<br />                      {name:"date",width:28},<br />                      {name:"api",width:16, hidden:true},<br />                      {name: "notes",   width: 300, editable: true, edittype: 'custom',<br />                         editoptions:<br />                         {<br />                            custom_element: function(value, options)<br />                            {<br />                               var elm = $("<textarea></textarea>");<br />                               elm.val(value);<br />                               // give the editor time to initialize<br />                               setTimeout(function()<br />                               {<br />                                  try<br />                                  {tinymce.remove("#" + options.id);}<br />                                  catch (ex) {}<br />                                  tinymce.init(<br />                                  {<br />                                     selector: "#" + options.id,<br />                                     plugins: "link"<br />                                  });<br />                               }, 50);<br />                               return elm;<br />                            },<br />                            custom_value: function(element, oper, gridval)<br />                            {<br />                               var id;<br />                               if (element.length > 0)<br />                               {id = element.attr("id");}<br />                               else if (typeof element.selector === "string")<br />                               {<br />                                  var sels = element.selector.split(" "),<br />                                     idSel = sels[sels.length - 1];<br />                                  if (idSel.charAt(0) === "#")<br />                                  {id = idSel.substring(1);}<br />                                  else<br />                                  {return "";}<br />                               }<br />                               if (oper === "get")<br />                               {return tinymce.get(id).getContent({format: "row"});}<br />                               else if (oper === "set")<br />                               {<br />                                  if (tinymce.get(id))<br />                                  {tinymce.get(id).setContent(gridval);}<br />                               }<br />                            }<br />                         }<br />                      }<br />                   ],<br />                   rowList: [],<br />                   pgbuttons: false,<br />                   pgtext: null,<br />                   viewrecords: false,<br />                   pager: pager_id,<br />                   height: '100%'<br />                });<br />                //second grid as sub grid<br />                $("#"+subgrid_id).append("<table id='"+subgrid_table_id2+"' class='scroll'></table>");<br />                jQuery("#"+subgrid_table_id2).jqGrid(<br />                {<br />                   url:"getwellfiles.php?api="+row_id,<br />                   datatype: "json",<br />                   autowidth: true,<br />                   colNames: ,<br />                   colModel: [<br />                      {name:"file_name",width:55, formatter: "link"},<br />                      {name:"file_type",width:18},<br />                      {name:"size",width:68},<br />                      {name:"description",width:28},<br />                      {name:"Last",width:28},<br />                      {name:"First",width:28}<br />                   ],<br />                   height: '100%',<br />                });<br />                //paging bar options for grid as subgrid (first)   <br />                jQuery("#"+subgrid_table_id).jqGrid<br />                (<br />                   'navGrid',<br />                   "#"+pager_id,<br />                   {<br />                      edit: true,<br />                      add: true,<br />                      del: true,<br />                      search: false,<br />                      view: true,<br />                      refresh: true<br />                   },<br />                   {<br />                      /*prmEdit*/<br />                      //url:"notesedit.php?userid="+<?php echo $userid; ?>,<br />                      width: 'auto',<br />                      height: 'auto'<br />                   },<br />                   {<br />                      /*prmAdd*/<br />                      url:"#",<br />                      width: 'auto',<br />                      height: 'auto'<br /> <br />                   },<br />                   { /*prmDel*/ } ,<br />                   { /*prmSearch*/ },<br />                   { /*prmView*/ }<br />                );<br />             },<br />             subGridRowColapsed: function(subgrid_id, row_id) {   }                  <br />          });<br />          //paging options for main grid<br />          jQuery("#grid").jqGrid<br />          (<br />             'navGrid','#pager',<br />             {<br />                edit: false,<br />                add: false,<br />                del: false,<br />                search: false,<br />                view: true,<br />                refresh: true<br />             },<br />             { /*prmEdit*/ },<br />             { /*prmAdd*/ },<br />             { /*prmDel*/ } ,<br />             {<br />                /*prmSearch*/<br />                multipleSearch:true<br />             },<br />             { /*prmView*/ }<br />          );<br />          //code to hide search bar in main paing bar<br />          $('#grid').jqGrid('filterToolbar', { searchOnEnter: true, enableClear: true });<br />          $('#grid').jqGrid('navButtonAdd', '#pager',<br />          {<br />                caption: "",<br />                title: "Toggle Search Toolbar",<br />                buttonicon: 'ui-icon-search',<br />                onClickButton: function ()<br />             {<br />                    this.toggleToolbar();<br />                    if ($.isFunction(this.p._complete))<br />                {<br />                        if ($('.ui-search-toolbar', this.grid.hDiv).is(':visible'))<br />                   {$('.ui-search-toolbar', this.grid.fhDiv).show();}<br />                   else<br />                   {$('.ui-search-toolbar', this.grid.fhDiv).hide();}<br />                        this.p._complete.call(this);<br />                        fixPositionsOfFrozenDivs.call(this);<br />                    }<br />                }<br />            });<br />          //$('.ui-search-toolbar').hide();<br />          jQuery("#s2").click( function() { jQuery("#grid").jqGrid('setGridParam',{sortname:"api",sortorder:"asc"}).trigger("reloadGrid");});<br />       });<br />        </script><br />    <!--jquery end datagrid components--> |
Copyright 2014 TriRand LtdAll Rights ReservedRSS
Back to Top