Advertisement
GL29

phpGrid-Select2

May 17th, 2016
185
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 38.87 KB | None | 0 0
  1. <?php
  2. /**
  3. * PHP Grid Component
  4. *
  5. * @author Abu Ghufran <gridphp@gmail.com> - http://www.phpgrid.org
  6. * @version 2.0.0
  7. * @license: see license.txt included in package
  8. */
  9.  
  10. include_once("config.php");
  11. include_once("crm_get_operator_name_from_ip.php");
  12.  
  13.  
  14. include(PHPGRID_LIBPATH."inc/jqgrid_dist.php");
  15.  
  16. // Database config file to be passed in phpgrid constructor
  17. $db_conf = array(
  18. "type" => PHPGRID_DBTYPE,
  19. "server" => PHPGRID_DBHOST,
  20. "user" => PHPGRID_DBUSER,
  21. "password" => PHPGRID_DBPASS,
  22. "database" => PHPGRID_DBNAME
  23. );
  24.  
  25.  
  26. // master Grid 01
  27. $g = new jqgrid($db_conf);
  28.  
  29. // following params will enable subgrid -- by default first column (PK) of parent is passed as param 'id'
  30. $optg1["detail_grid_id"] = "list2,list3";
  31. $optg1["height"] = "200";
  32. $optg1["width"] = "1220";
  33.  
  34. $g->set_options($optg1);
  35.  
  36. // you can provide custom SQL query to display data
  37.  
  38. $g->select_command = " SELECT m.cie_id, m.cie_name, m.phone, m.town, m.postcode,
  39. s.status_name as status_id, m.address, c.local_name as country_id, m.contact_name, m.email, m.website, m.source, m.frtmap_code, m.created_by, g.group_name as group_id,
  40. color.color_desc as color_id, main_countries_from
  41. FROM crm_main m
  42. INNER JOIN crm_country c ON c.country_id = m.country_id
  43. INNER JOIN crm_group g ON g.group_id = m.group_id
  44. INNER JOIN crm_status s ON s.status_id = m.status_id
  45. INNER JOIN crm_color color ON color.color_id = m.color_id
  46. ";
  47.  
  48.  
  49.  
  50. $grid["caption"] = "CUSTOMER PROSPECT RELATION MANAGEMENT SYSTEM [$operator_name] [$ip]";
  51. $grid["rownumbers"] = true;
  52. $grid["rownumWidth"] = 30;
  53. $grid["resizable"] = false; // defaults to false
  54. $grid["autoresize"] = false; // defaults to false
  55.  
  56. $grid["loadtext"] = "Loading your customer list ...";
  57.  
  58. $grid["toolbar"] = "both";
  59. $grid["multiselect"] = false;
  60. $grid["altRows"] = true;
  61.  
  62. // Date will be sorted desc, and ID asc.
  63. $grid["sortname"] = "cie_name ASC,cie_id";
  64. $grid["sortorder"] = "ASC";
  65.  
  66. $grid["scroll"] = false; ///// SCROLL INSTEAD OF PAGE SELECTION
  67. $grid["cellEdit"] = false; /// Editing like Excel
  68. $grid["toppager"] = true;
  69.  
  70. // export XLS file
  71. // export to excel parameters
  72. $grid["export"] = array("format"=>"pdf", "filename"=>"my-file", "sheetname"=>"test");
  73.  
  74. $grid["add_options"] = array("recreateForm" => true, "closeAfterEdit"=>true, 'width'=>'450', 'top'=>'200', 'left'=>'400');
  75. $grid["edit_options"] = array("recreateForm" => true, "closeAfterEdit"=>true, 'width'=>'450', 'top'=>'200', 'left'=>'400');
  76. $grid["view_options"] = array("recreateForm" => true, "closeAfterEdit"=>true, 'width'=>'450', 'top'=>'200', 'left'=>'400');
  77.  
  78.  
  79. $grid["add_options"]["editData"]["created_by"] = $operator_name;
  80. $grid["add_options"]["editData"]["created_date"] = date("Y-m-d");
  81.  
  82. $grid["edit_options"]["editData"]["updated_by"] = $operator_name;
  83. $grid["edit_options"]["editData"]["updated_date"] = date("Y-m-d");
  84.  
  85. $g->set_options($grid);
  86.  
  87.  
  88. $eg1["js_on_load_complete"] = "grid_onloadGrid01";
  89. $g->set_events($eg1);
  90.  
  91.  
  92.  
  93. /////////////////////////////////
  94. ////////////////////////////////
  95.  
  96. $g->set_actions(array(
  97. "add"=>true, // allow/disallow add
  98. "edit"=>true, // allow/disallow edit
  99. "delete"=>true, // allow/disallow delete
  100. "rowactions"=>false, // show/hide row wise edit/del/save option
  101. "export"=>true, // show/hide export to excel option
  102. "autofilter" => true, // show/hide autofilter for search
  103. "search" => "advance", // show single/multi field search condition (e.g. simple or advance)
  104. "showhidecolumns" => true
  105. )
  106. );
  107.  
  108. /////////////////////////////////
  109. /////////////////////////////////
  110.  
  111. $col = array();
  112. $col["title"] = "ID"; // caption of column
  113. $col["name"] = "cie_id"; // grid column name, must be exactly same as returned column-name from sql (tablefield or field-alias)
  114. $col["width"] = "10";
  115. $col["hidden"] = true; // HIDE this column
  116. //$col["editrules"] = array("edithidden"=>true);
  117. $col["align"] = "center"; // this column is not editable
  118. $col["editable"] = false; // this column is not editable
  119. $col["search"] = false; // this column is not searchable
  120. $cols[] = $col;
  121.  
  122.  
  123. ////////////////
  124. ////////////////
  125.  
  126. # Custom made column to show link, must have default value as it's not db driven
  127. $col = array();
  128. $col["title"] = "Details";
  129. $col["name"] = "more_options";
  130. $col["width"] = "30";
  131. $col["align"] = "center";
  132. $col["search"] = false;
  133. $col["sortable"] = false;
  134. # no new line in this html, only space. otherwise it may break ui of grid
  135. $buttons_html = "<input type='button' value='Edit' onclick='open_edit(this)'>";
  136. $col["default"] = $buttons_html;
  137. $cols[] = $col;
  138.  
  139.  
  140. ///////////////////////
  141. ///////////////////////
  142.  
  143. $col = array();
  144. $col["title"] = "Prospect";
  145. $col["name"] = "cie_name";
  146. $col["width"] = "30";
  147. $col["editable"] = true; // this column is not editable
  148. $col["align"] = "center"; // this column is not editable
  149. $col["search"] = true; // this column is not searchable
  150. $col["editoptions"] = array("size"=>50);
  151. $col["editrules"] = array("required"=>true); // and is required
  152. $cols[] = $col;
  153.  
  154. //////////
  155. /////////
  156.  
  157. $col = array();
  158. $col["title"] = "Town";
  159. $col["name"] = "town";
  160. $col["width"] = "30";
  161. $col["sortable"] = true; // this column is not sortable
  162. $col["search"] = true; // this column is not searchable
  163. $col["editable"] = true;
  164. $col["editoptions"] = array("size"=>50);
  165. $col["editrules"] = array("required"=>true); // and is required
  166. $cols[] = $col;
  167.  
  168. //////////
  169. /////////
  170.  
  171. $col = array();
  172. $col["title"] = "Postcode";
  173. $col["name"] = "postcode";
  174. $col["width"] = "25";
  175. $col["align"] = "center"; // this column is not editable
  176. $col["sortable"] = false; // this column is not sortable
  177. $col["search"] = true; // this column is not searchable
  178. $col["editable"] = true;
  179. $col["editoptions"] = array("size"=>12);
  180. $col["hidden"] = true; // HIDE this column
  181. $col["editrules"] = array("edithidden"=>true);
  182. $cols[] = $col;
  183.  
  184. //////////
  185. /////////
  186.  
  187. $col = array();
  188. $col["title"] = "Country";
  189. $col["name"] = "country_id";
  190. $col["width"] = "50";
  191. $col["align"] = "center"; // this column is not editable
  192. $col["sortable"] = true; // this column is not sortable
  193. $col["search"] = true; // this column is not searchable
  194.  
  195. $col["dbname"] = "c.country_id"; // this is required as we need to search in name field, not id
  196. $col["editable"] = true;
  197.  
  198. # fetch data from database, with alias k for key, v for value
  199. $str = $g->get_dropdown_values("select distinct country_id as k, local_name as v from crm_country where type = 'CO' ORDER BY local_name");
  200.  
  201. $col["edittype"] = "select"; // render as select
  202. $col["editoptions"] = array("value"=>$str, "defaultValue" => "United Kingdom");
  203. $col["editoptions"]["dataInit"] = "function(){ setTimeout(function(){ link_select2('{$col["name"]}'); },200); }";
  204.  
  205. $col["stype"] = "select"; // render as select
  206. $col["searchoptions"] = array("value"=>$str);
  207. $col["searchoptions"]["dataInit"] = "function(){ setTimeout(function(){ link_select2('gs_{$col["name"]}'); },200); }";
  208.  
  209. $col["editrules"] = array("required"=>true); // and is required
  210.  
  211. $cols[] = $col;
  212.  
  213. //////////
  214. /////////
  215.  
  216. $col = array();
  217. $col["title"] = "Address";
  218. $col["name"] = "address";
  219. $col["width"] = "60";
  220. $col["sortable"] = false; // this column is not sortable
  221. $col["search"] = false; // this column is not searchable
  222. $col["editable"] = true;
  223. $col["edittype"] = "textarea"; // render as textarea on edit
  224. $col["editoptions"] = array("rows"=>4, "cols"=>51); // with these attributes
  225. $col["hidden"] = true; // HIDE this column
  226. $col["editrules"] = array("edithidden"=>true);
  227. $cols[] = $col;
  228.  
  229. //////////
  230. /////////
  231.  
  232. $col = array();
  233. $col["title"] = "Contact Name";
  234. $col["name"] = "contact_name";
  235. $col["width"] = "50";
  236. $col["editable"] = true; // this column is not editable
  237. $col["align"] = "center"; // this column is not editable
  238. $col["search"] = true; // this column is not searchable
  239. $cols[] = $col;
  240.  
  241. //////////
  242.  
  243.  
  244. $col = array();
  245. $col["title"] = "Phone";
  246. $col["name"] = "phone";
  247. $col["width"] = "35";
  248. $col["align"] = "center"; // this column is not editable
  249. $col["sortable"] = false; // this column is not sortable
  250. $col["search"] = true; // this column is not searchable
  251. $col["editable"] = true;
  252. $col["editoptions"] = array("size"=>20); // with default display of textbox with size 20
  253. $cols[] = $col;
  254.  
  255.  
  256. //////////
  257. /////////
  258.  
  259. $col = array();
  260. $col["title"] = "Email";
  261. $col["name"] = "email";
  262. $col["width"] = "50";
  263. $col["align"] = "center"; // this column is not editable
  264. $col["sortable"] = false; // this column is not sortable
  265. $col["search"] = true; // this column is not searchable
  266. $col["editable"] = true;
  267. $col["editoptions"] = array("size"=>50); // with default display of textbox with size 20
  268. $col["formatter"] = "function(cellval,options,rowdata){ return '<a href=\"mailto:'+cellval+'\">'+cellval+'</a>'; }";
  269. $col["unformat"] = "function(cellval,options,cell){ return $('a', cell).attr('href').replace('mailto:',''); }";
  270. $cols[] = $col;
  271.  
  272.  
  273. //////////
  274. /////////
  275.  
  276. $col = array();
  277. $col["title"] = "Website";
  278. $col["name"] = "website";
  279. $col["width"] = "50";
  280. $col["align"] = "center"; // this column is not editable
  281. $col["sortable"] = false; // this column is not sortable
  282. $col["search"] = true; // this column is not searchable
  283. $col["editable"] = true;
  284. $col["editoptions"] = array("size"=>50); // with default display of textbox with size 20
  285. $col["formatter"] = "function(cellval,options,rowdata){ return '<a target=\"_blank\" href=\"http://'+cellval+'\">'+cellval+'</a>'; }";
  286. $col["unformat"] = "function(cellval,options,cell){ return $('a', cell).attr('href').replace('http://',''); }";
  287. $cols[] = $col;
  288.  
  289.  
  290. //////////
  291. /////////
  292.  
  293. $col = array();
  294. $col["title"] = "Group";
  295. $col["name"] = "group_id";
  296. $col["width"] = "50";
  297. $col["align"] = "center"; // this column is not editable
  298. $col["sortable"] = true; // this column is not sortable
  299. $col["search"] = true; // this column is not searchable
  300.  
  301. $col["dbname"] = "g.group_id"; // this is required as we need to search in name field, not id
  302. $col["editable"] = true;
  303.  
  304. # fetch data from database, with alias k for key, v for value
  305. $str = $g->get_dropdown_values("select distinct group_id as k, group_name as v from crm_group ORDER BY group_name");
  306.  
  307. $col["edittype"] = "select"; // render as select
  308. $col["editoptions"] = array("value"=>$str, "defaultValue" => "Default Group");
  309. $col["editoptions"]["dataInit"] = "function(){ setTimeout(function(){ link_select2('{$col["name"]}'); },200); }";
  310.  
  311. $col["stype"] = "select"; // render as select
  312. $col["searchoptions"] = array("value"=>$str);
  313. $col["searchoptions"]["dataInit"] = "function(){ setTimeout(function(){ link_select2('gs_{$col["name"]}'); },200); }";
  314.  
  315. $cols[] = $col;
  316.  
  317. ////////////////////////
  318. ////////////////////////
  319.  
  320.  
  321.  
  322. $col = array();
  323. $col["title"] = "Source";
  324. $col["name"] = "source";
  325. $col["width"] = "30";
  326. $col["align"] = "center"; // this column is not editable
  327. $col["sortable"] = false; // this column is not sortable
  328. $col["search"] = true; // this column is not searchable
  329. $col["editable"] = true;
  330. $col["editoptions"] = array("size"=>30); // with default display of textbox with size 20
  331. $col["hidden"] = true; // HIDE this column
  332. $col["editrules"] = array("edithidden"=>true);
  333. $cols[] = $col;
  334.  
  335.  
  336. //////////
  337. /////////
  338.  
  339. $col = array();
  340. $col["title"] = "FRTMAP";
  341. $col["name"] = "frtmap_code";
  342. $col["width"] = "25";
  343. $col["align"] = "center"; // this column is not editable
  344. $col["sortable"] = false; // this column is not sortable
  345. $col["search"] = true; // this column is not searchable
  346. $col["editable"] = true;
  347. $col["editoptions"] = array("size"=>10); // with default display of textbox with size 20
  348. $col["hidden"] = true; // HIDE this column
  349. $col["editrules"] = array("edithidden"=>true);
  350. $cols[] = $col;
  351.  
  352.  
  353. ////////////////////////
  354. ////////////////////////
  355.  
  356. $col = array();
  357. $col["title"] = "By";
  358. $col["name"] = "created_by";
  359. $col["width"] = "20";
  360. $col["align"] = "center";
  361. $col["sortable"] = true; // this column is not sortable
  362. $col["search"] = true; // this column is not searchable
  363. $col["editable"] = false;
  364. $col["hidden"] = true; // HIDE this column
  365. //$col["editrules"] = array("edithidden"=>true);
  366. $cols[] = $col;
  367.  
  368.  
  369. ////////////////////////
  370. ////////////////////////
  371.  
  372.  
  373. $col = array();
  374. $col["title"] = "Color";
  375. $col["name"] = "color_id";
  376. $col["width"] = "25";
  377. $col["align"] = "center"; // this column is not editable
  378. $col["sortable"] = true; // this column is not sortable
  379. $col["search"] = true; // this column is not searchable
  380.  
  381. $col["dbname"] = "color.color_id"; // this is required as we need to search in name field, not id
  382. $col["editable"] = true;
  383.  
  384. # fetch data from database, with alias k for key, v for value
  385. $str = $g->get_dropdown_values("select distinct color_id as k, color_desc as v from crm_color ORDER BY color_desc");
  386.  
  387. $col["edittype"] = "select"; // render as select
  388. $col["editoptions"] = array("value"=>$str, "defaultValue" => "White");
  389. $col["editoptions"]["dataInit"] = "function(){ setTimeout(function(){ link_select2('{$col["name"]}'); },200); }";
  390.  
  391. $col["stype"] = "select"; // render as select
  392. $col["searchoptions"] = array("value"=>$str);
  393. $col["searchoptions"]["dataInit"] = "function(){ setTimeout(function(){ link_select2('gs_{$col["name"]}'); },200); }";
  394.  
  395. $cols[] = $col;
  396.  
  397.  
  398. //////////
  399. /////////
  400.  
  401.  
  402. $col = array();
  403. $col["title"] = "From";
  404. $col["name"] = "main_countries_from";
  405. $col["width"] = "50";
  406. $col["align"] = "center"; // this column is not editable
  407. $col["sortable"] = true; // this column is not sortable
  408. $col["search"] = true; // this column is not searchable
  409.  
  410. $col["dbname"] = "main_countries_from"; // this is required as we need to search in name field, not id
  411. $col["editable"] = true;
  412.  
  413. # fetch data from database, with alias k for key, v for value
  414. $str = $g->get_dropdown_values("select distinct country_id as k, local_name as v from crm_country where type = 'CO' ORDER BY local_name");
  415.  
  416. $col["edittype"] = "select"; // render as select
  417. $col["editoptions"] = array("value"=>$str, "defaultValue" => "United Kingdom");
  418. $col["editoptions"]["dataInit"] = "function(){ setTimeout(function(){ link_select2('{$col["name"]}'); },200); }";
  419.  
  420. $col["stype"] = "select"; // render as select
  421. $col["searchoptions"] = array("value"=>$str);
  422. $col["searchoptions"]["dataInit"] = "function(){ setTimeout(function(){ link_select2('gs_{$col["name"]}'); },200); }";
  423.  
  424. // to enable multiselect option
  425. $col["editoptions"]["multiple"] = true;
  426.  
  427. $col["stype"] = "select"; // render as select
  428. $col["searchoptions"] = array("value"=>$str);
  429. $col["searchoptions"]["dataInit"] = "function(){ setTimeout(function(){ link_select2('gs_{$col["name"]}'); },200); }";
  430.  
  431. $cols[] = $col;
  432.  
  433. ///////////////////////////
  434. ///////////////////////////
  435.  
  436.  
  437. $col = array();
  438. $col["title"] = "Status";
  439. $col["name"] = "status_id";
  440. $col["width"] = "20";
  441. $col["align"] = "center"; // this column is not editable
  442. $col["sortable"] = true; // this column is not sortable
  443. $col["search"] = true; // this column is not searchable
  444.  
  445. $col["dbname"] = "s.status_id"; // this is required as we need to search in name field, not id
  446. $col["editable"] = true;
  447.  
  448. # fetch data from database, with alias k for key, v for value
  449. $str = $g->get_dropdown_values("select distinct status_id as k, status_name as v from crm_status ORDER BY status_id");
  450.  
  451.  
  452. //echo "</br>**** $str ***";
  453.  
  454. $col["edittype"] = "select"; // render as select
  455. $col["editoptions"] = array("value"=>$str, "defaultValue" => "Live");
  456. $col["editoptions"]["dataInit"] = "function(){ setTimeout(function(){ link_select2('{$col["name"]}'); },200); }";
  457.  
  458. $col["stype"] = "select"; // render as select
  459. $col["searchoptions"] = array("value"=>$str);
  460. $col["searchoptions"]["dataInit"] = "function(){ setTimeout(function(){ link_select2('gs_{$col["name"]}'); },200); }";
  461.  
  462. $cols[] = $col;
  463.  
  464.  
  465.  
  466.  
  467. /////////
  468. /////////
  469. // pass the cooked columns to grid
  470. $g->set_columns($cols);
  471.  
  472. /////////////////////////////////
  473. /////////////////////////////////
  474.  
  475.  
  476.  
  477.  
  478.  
  479. // conditional css formatting of rows
  480. //$f = array();
  481. //$f["column"] = "color_id"; // exact column name, as defined above in set_columns or sql field name
  482. //$f["op"] = "cn"; // cn - contains, eq - equals
  483. //$f["value"] = "Yellow";
  484. //$f["css"] = "'background-color':'#FFFF00', 'color':'black', 'font-weight':''"; // must use (single quote ') with css attr and value
  485. //$f_conditions[] = $f;
  486.  
  487. //$f = array();
  488. //$f["column"] = "color_id"; // exact column name, as defined above in set_columns or sql field name
  489. //$f["op"] = "cn"; // cn - contains, eq - equals
  490. //$f["value"] = "Green";
  491. //$f["css"] = "'background-color':'#33FF00', 'color':'black', 'font-weight':''"; // must use (single quote ') with css attr and value
  492. //$f_conditions[] = $f;
  493.  
  494. //$f = array();
  495. //$f["column"] = "color_id"; // exact column name, as defined above in set_columns or sql field name
  496. //$f["op"] = "cn"; // cn - contains, eq - equals
  497. //$f["value"] = "Red";
  498. //$f["css"] = "'background-color':'#FF0000', 'color':'black', 'font-weight':''"; // must use (single quote ') with css attr and value
  499. //$f_conditions[] = $f;
  500.  
  501.  
  502. //$g->set_conditional_css($f_conditions);
  503.  
  504.  
  505.  
  506.  
  507. ///////////////////////////////////
  508. ///////////////////////////////////
  509.  
  510.  
  511.  
  512. $g->table = "crm_main";
  513. $out_master = $g->render("list1");
  514.  
  515.  
  516.  
  517.  
  518.  
  519. ////////////////////////////////////////////////////////////////
  520. ////////////////////////////////////////////////////////////////
  521. // Grid 02
  522. $g2 = new jqgrid($db_conf);
  523.  
  524.  
  525.  
  526. $optg2 = array();
  527. $optg2["sortname"] = 'note_id'; // by default sort grid by this field
  528. $optg2["sortorder"] = "desc"; // ASC or DESC
  529. $optg2["height"] = "300";
  530. $optg2["width"] = "500";
  531. $optg2["caption"] = "Company Notes / Quotes"; // caption of grid
  532. $optg2["multiselect"] = false; // allow you to multi-select through checkboxes
  533. $optg2["toolbar"] = top;
  534. $optg2["rownumbers"] = true;
  535. $optg2["rownumWidth"] = 30;
  536. $optg2["resizable"] = false;
  537. $optg2["autoresize"] = false;
  538. $optg2["scroll"] = true;
  539. $optg2["loadtext"] = "Loading Notes / Quotes ...";
  540. //$optg2["cellEdit"] = true;
  541. $optg2["reloadedit"] = false;
  542.  
  543. $optg2["add_options"] = array("recreateForm" => true, "closeAfterEdit"=>true, 'width'=>'600', 'top'=>'200', 'left'=>'200');
  544. $optg2["edit_options"] = array("recreateForm" => true, "closeAfterEdit"=>true, 'width'=>'600', 'top'=>'200', 'left'=>'200');
  545. $optg2["view_options"] = array("recreateForm" => true, "closeAfterEdit"=>true, 'width'=>'600', 'top'=>'200', 'left'=>'200');
  546.  
  547. $optg2["add_options"]["editData"]["created_by"] = $operator_name;
  548. $optg2["add_options"]["editData"]["created_date"] = date("Y-m-d");
  549.  
  550. $optg2["edit_options"]["editData"]["updated_by"] = $operator_name;
  551. $optg2["edit_options"]["editData"]["updated_date"] = date("Y-m-d");
  552.  
  553. $g2->set_options($optg2);
  554.  
  555. $cols = array();
  556.  
  557.  
  558. $g2->set_actions(array(
  559. "add"=>true, // allow/disallow add
  560. "edit"=>true, // allow/disallow edit
  561. "delete"=>true, // allow/disallow delete
  562. "rowactions"=>false, // show/hide row wise edit/del/save option
  563. "export"=>true, // show/hide export to excel option
  564. "autofilter" => true, // show/hide autofilter for search
  565. "search" => "simple", // show single/multi field search condition (e.g. simple or advance)
  566. "showhidecolumns" => true
  567. )
  568. );
  569.  
  570. // receive id, selected row of parent grid
  571. $id = intval($_GET["rowid"]);
  572. // and use in sql for filteration
  573. $g2->select_command = "SELECT note_id, note, cie_id, created_by, created_date, updated_by, updated_date FROM crm_notes WHERE cie_id='$id'";
  574.  
  575.  
  576.  
  577.  
  578.  
  579. $eg2["on_insert"] = array("add_noteGrid02", null, true);
  580. //$eg2["on_update"] = array("update_note_Grid02", null, true);
  581. //$eg2["on_after_insert"] = array("after_insert_note_Grid02", null, true);
  582.  
  583. $g2->set_events($eg2);
  584.  
  585.  
  586. function add_noteGrid02($data)
  587. {
  588. $id = intval($_GET["rowid"]);
  589. $data["params"]["cie_id"] = $id;
  590. }
  591.  
  592.  
  593.  
  594.  
  595.  
  596.  
  597.  
  598. /////////////////////////////////
  599. /////////////////////////////////
  600.  
  601. $col = array();
  602. $col["title"] = "ID"; // caption of column
  603. $col["name"] = "note_id"; // grid column name, must be exactly same as returned column-name from sql (tablefield or field-alias)
  604. $col["width"] = "5";
  605. $col["hidden"] = true; // HIDE this column
  606. //$col["editrules"] = array("edithidden"=>true);
  607. $col["align"] = "center"; // this column is not editable
  608. $col["editable"] = false; // this column is not editable
  609. $col["search"] = false; // this column is not searchable
  610. $cols[] = $col;
  611.  
  612.  
  613. ///////////////////////
  614. ///////////////////////
  615.  
  616. //# Custom made column to show link, must have default value as it's not db driven
  617. $col = array();
  618. $col["title"] = "Details";
  619. $col["name"] = "more_options";
  620. $col["width"] = "25";
  621. $col["align"] = "center";
  622. $col["search"] = false;
  623. $col["sortable"] = false;
  624. # no new line in this html, only space. otherwise it may break ui of grid
  625. $buttons_htmlGrid2 = "<input type='button' value='Edit' onclick='open_editGrid2(this)'>";
  626. $col["default"] = $buttons_htmlGrid2;
  627. $cols[] = $col;
  628.  
  629.  
  630. ///////////////////////
  631. ///////////////////////
  632.  
  633. $col = array();
  634. $col["title"] = "Cie ID";
  635. $col["name"] = "cie_id";
  636. $col["width"] = "5";
  637. $col["editable"] = false; // this column is not editable
  638. $col["align"] = "center"; // this column is not editable
  639. $col["search"] = false; // this column is not searchable
  640. $col["hidden"] = true; // HIDE this column
  641. $cols[] = $col;
  642.  
  643.  
  644. //////////
  645. /////////
  646.  
  647.  
  648. $col = array();
  649. $col["title"] = "Date";
  650. $col["name"] = "created_date";
  651. $col["width"] = "30";
  652. $col["align"] = "center";
  653. $col["editable"] = false; // this column is editable
  654. $col["search"] = false; // this column is not searchable
  655. $col["editrules"] = array("required"=>true); // and is required
  656.  
  657. $col["formatter"] = "date";
  658. # opts array can have these options: http://api.jqueryui.com/datepicker/
  659. $col["formatoptions"] = array("srcformat"=>'Y-m-d',"newformat"=>'d.m.y', "opts" => array("changeYear" => true, "dateFormat"=>'yy-mm-dd', "minDate"=>"16-04-01"));
  660.  
  661. // to perfor contains search, uncomment following - will disable datepicker
  662. // $col["searchoptions"]["sopt"] = array("cn");
  663. // search date in format Jan 23, 2008
  664. // $col["dbname"] = "date_format(invdate,'%b %d, %Y')";
  665.  
  666. $col["hidden"] = false; // HIDE this column
  667.  
  668. $cols[] = $col;
  669.  
  670. ////////////////////////
  671. ////////////////////////
  672.  
  673.  
  674. $col = array();
  675. $col["title"] = "Note / Quote";
  676. $col["name"] = "note";
  677. $col["width"] = "150";
  678. $col["sortable"] = false; // this column is not sortable
  679. $col["search"] = true; // this column is not searchable
  680. $col["editable"] = true;
  681. $col["edittype"] = "textarea"; // render as textarea on edit
  682. $col["editoptions"] = array("rows"=>6, "cols"=>90); // with these attributes
  683. $col["hidden"] = false; // HIDE this column
  684. $col["editrules"] = array("edithidden"=>true);
  685. $col["editrules"] = array("required"=>true); // and is required
  686.  
  687. $cols[] = $col;
  688.  
  689.  
  690. //////////
  691. /////////
  692.  
  693. $col = array();
  694. $col["title"] = "By";
  695. $col["name"] = "created_by";
  696. $col["width"] = "40";
  697. $col["align"] = "center"; // this column is not editable
  698. $col["sortable"] = true; // this column is not sortable
  699. $col["search"] = true; // this column is not searchable
  700. $col["editable"] = false;
  701. $col["hidden"] = true; // HIDE this column
  702. //$col["editrules"] = array("edithidden"=>true);
  703. $cols[] = $col;
  704.  
  705.  
  706.  
  707.  
  708. ////////////////////////
  709. ////////////////////////
  710.  
  711. $col = array();
  712. $col["title"] = "UPD By";
  713. $col["name"] = "updated_by";
  714. $col["width"] = "50";
  715. $col["align"] = "center"; // this column is not editable
  716. $col["sortable"] = true; // this column is not sortable
  717. $col["search"] = true; // this column is not searchable
  718. $col["editable"] = false;
  719. $col["hidden"] = true; // HIDE this column
  720. //$col["editrules"] = array("edithidden"=>true);
  721. $cols[] = $col;
  722.  
  723.  
  724. //////////
  725. /////////
  726.  
  727. $col = array();
  728. $col["title"] = "UPD Date";
  729. $col["name"] = "updated_date";
  730. $col["width"] = "50";
  731. $col["align"] = "center";
  732. $col["editable"] = false; // this column is editable
  733. $col["search"] = true; // this column is not searchable
  734. $col["hidden"] = true; // HIDE this column
  735. //$col["editrules"] = array("required"=>true); // and is required
  736.  
  737. $col["formatter"] = "date";
  738. # opts array can have these options: http://api.jqueryui.com/datepicker/
  739. $col["formatoptions"] = array("srcformat"=>'Y-m-d',"newformat"=>'d.m.y', "opts" => array("changeYear" => true, "dateFormat"=>'yy-mm-dd', "minDate"=>"16-04-01"));
  740.  
  741. // to perfor contains search, uncomment following - will disable datepicker
  742. // $col["searchoptions"]["sopt"] = array("cn");
  743. // search date in format Jan 23, 2008
  744. // $col["dbname"] = "date_format(invdate,'%b %d, %Y')";
  745.  
  746.  
  747.  
  748. $cols[] = $col;
  749.  
  750.  
  751. //////////
  752. /////////
  753.  
  754.  
  755.  
  756. /////////
  757.  
  758. // pass the cooked columns to grid
  759. $g2->set_columns($cols);
  760.  
  761. // generate grid output, with unique grid name as 'list1'
  762. $g2->table = "crm_notes";
  763. $out_list2 = $g2->render("list2");
  764.  
  765.  
  766.  
  767.  
  768. ////// END Detail Grid 02
  769. ////////////////////////////////////////////////////////////////
  770. ////////////////////////////////////////////////////////////////
  771.  
  772.  
  773.  
  774.  
  775.  
  776.  
  777. ////////////////////////////////////////////////////////////////
  778. ////////////////////////////////////////////////////////////////
  779. // Grid 03 - PHONE LOG TABLE
  780. $g3 = new jqgrid($db_conf);
  781.  
  782.  
  783.  
  784. $optg3 = array();
  785. $optg3["sortname"] = 'log_id'; // by default sort grid by this field
  786. $optg3["sortorder"] = "desc"; // ASC or DESC
  787. $optg3["height"] = "300";
  788. $optg3["width"] = "710";
  789. $optg3["caption"] = "Company Phone Log"; // caption of grid
  790. $optg3["multiselect"] = false; // allow you to multi-select through checkboxes
  791. $optg3["toolbar"] = top;
  792. $optg3["rownumbers"] = true;
  793. $optg3["rownumWidth"] = 30;
  794. $optg3["resizable"] = false;
  795. $optg3["autoresize"] = false;
  796. $optg3["scroll"] = true;
  797. $optg3["loadtext"] = "Loading Phone Log ...";
  798. //$optg3["cellEdit"] = true;
  799. $optg3["reloadedit"] = false;
  800.  
  801. $optg3["add_options"] = array("recreateForm" => true, "closeAfterEdit"=>true, 'width'=>'600', 'top'=>'200', 'left'=>'400');
  802. $optg3["edit_options"] = array("recreateForm" => true, "closeAfterEdit"=>true, 'width'=>'600', 'top'=>'200', 'left'=>'400');
  803. $optg3["view_options"] = array("recreateForm" => true, "closeAfterEdit"=>true, 'width'=>'600', 'top'=>'200', 'left'=>'400');
  804.  
  805. $optg3["add_options"]["editData"]["created_by"] = $operator_name;
  806. $optg3["add_options"]["editData"]["log_date"] = date("Y-m-d");
  807.  
  808. $optg3["edit_options"]["editData"]["updated_by"] = $operator_name;
  809. $optg3["edit_options"]["editData"]["updated_date"] = date("Y-m-d");
  810.  
  811. $g3->set_options($optg3);
  812.  
  813. $cols = array();
  814.  
  815.  
  816. $g3->set_actions(array(
  817. "add"=>true, // allow/disallow add
  818. "edit"=>true, // allow/disallow edit
  819. "delete"=>true, // allow/disallow delete
  820. "rowactions"=>false, // show/hide row wise edit/del/save option
  821. "export"=>true, // show/hide export to excel option
  822. "autofilter" => true, // show/hide autofilter for search
  823. "search" => "simple", // show single/multi field search condition (e.g. simple or advance)
  824. "showhidecolumns" => true
  825. )
  826. );
  827.  
  828. // receive id, selected row of parent grid
  829. $id = intval($_GET["rowid"]);
  830. // and use in sql for filteration
  831. $g3->select_command = "SELECT log.log_id, log.cie_id, log.log_date, log.log_notes, log.follow_up_date, log.updated_by, log.updated_date, log.created_by, log.checked,
  832. ops.operator_name as follow_up_operator FROM crm_log log INNER JOIN crm_operators ops ON ops.operator_id = log.follow_up_operator WHERE log.cie_id='$id'";
  833.  
  834.  
  835.  
  836. $eg3["on_insert"] = array("add_logGrid03", null, true);
  837. $eg3["on_update"] = array("update_log_Grid03", null, true);
  838.  
  839. $g3->set_events($eg3);
  840.  
  841.  
  842. function add_logGrid03($data)
  843. {
  844. $id = intval($_GET["rowid"]);
  845. $data["params"]["cie_id"] = $id;
  846. }
  847.  
  848.  
  849.  
  850. /////////////////////////////////
  851. /////////////////////////////////
  852.  
  853. $col = array();
  854. $col["title"] = "ID"; // caption of column
  855. $col["name"] = "log_id"; // grid column name, must be exactly same as returned column-name from sql (tablefield or field-alias)
  856. $col["width"] = "5";
  857. $col["hidden"] = true; // HIDE this column
  858. //$col["editrules"] = array("edithidden"=>true);
  859. $col["align"] = "center"; // this column is not editable
  860. $col["editable"] = false; // this column is not editable
  861. $col["search"] = false; // this column is not searchable
  862. $cols[] = $col;
  863.  
  864.  
  865. ////////////////
  866. ////////////////
  867.  
  868. //# Custom made column to show link, must have default value as it's not db driven
  869. $col = array();
  870. $col["title"] = "Details";
  871. $col["name"] = "more_options";
  872. $col["width"] = "25";
  873. $col["align"] = "center";
  874. $col["search"] = false;
  875. $col["sortable"] = false;
  876. # no new line in this html, only space. otherwise it may break ui of grid
  877. $buttons_htmlGrid3 = "<input type='button' value='Edit' onclick='open_editGrid3(this)'>";
  878. $col["default"] = $buttons_htmlGrid3;
  879. $cols[] = $col;
  880.  
  881.  
  882. ///////////////////////
  883. ///////////////////////
  884.  
  885. $col = array();
  886. $col["title"] = "Cie ID";
  887. $col["name"] = "cie_id";
  888. $col["width"] = "5";
  889. $col["editable"] = false; // this column is not editable
  890. $col["align"] = "center"; // this column is not editable
  891. $col["search"] = false; // this column is not searchable
  892. $col["hidden"] = true; // HIDE this column
  893. $cols[] = $col;
  894.  
  895.  
  896. //////////
  897. /////////
  898.  
  899. $col = array();
  900. $col["title"] = "Date";
  901. $col["name"] = "log_date";
  902. $col["width"] = "20";
  903. $col["align"] = "center";
  904. $col["editable"] = false; // this column is editable
  905. $col["search"] = false; // this column is not searchable
  906. $col["editrules"] = array("required"=>true); // and is required
  907.  
  908. $col["formatter"] = "date";
  909. # opts array can have these options: http://api.jqueryui.com/datepicker/
  910. $col["formatoptions"] = array("srcformat"=>'Y-m-d',"newformat"=>'d.m.y', "opts" => array("changeYear" => true, "dateFormat"=>'yy-mm-dd', "minDate"=>"16-04-01"));
  911.  
  912. // to perfor contains search, uncomment following - will disable datepicker
  913. // $col["searchoptions"]["sopt"] = array("cn");
  914. // search date in format Jan 23, 2008
  915. // $col["dbname"] = "date_format(invdate,'%b %d, %Y')";
  916.  
  917. $col["hidden"] = false; // HIDE this column
  918.  
  919. $cols[] = $col;
  920.  
  921. //////////
  922. /////////
  923.  
  924.  
  925. $col = array();
  926. $col["title"] = "Call Log";
  927. $col["name"] = "log_notes";
  928. $col["width"] = "110";
  929. $col["sortable"] = false; // this column is not sortable
  930. $col["search"] = true; // this column is not searchable
  931. $col["editable"] = true;
  932. $col["edittype"] = "textarea"; // render as textarea on edit
  933. $col["editoptions"] = array("rows"=>6, "cols"=>90); // with these attributes
  934. $col["hidden"] = false; // HIDE this column
  935. $col["editrules"] = array("edithidden"=>true);
  936. $col["editrules"] = array("required"=>true); // and is required
  937. $cols[] = $col;
  938.  
  939.  
  940. //////////
  941. /////////
  942.  
  943.  
  944. $col = array();
  945. $col["title"] = "FWUP";
  946. $col["name"] = "follow_up_date";
  947. $col["width"] = "20";
  948. $col["align"] = "center";
  949. $col["editable"] = true; // this column is editable
  950. $col["editoptions"] = array("size"=>20); // with default display of textbox with size 20
  951. $col["editrules"] = array("required"=>false, "edithidden"=>true); // and is required
  952. # format as date
  953. $col["formatter"] = "date";
  954. # opts array can have these options: http://api.jqueryui.com/datepicker/
  955. $col["formatoptions"] = array("srcformat"=>'Y-m-d',"newformat"=>'d.m.y', "opts" => array("changeYear" => true, "dateFormat"=>'yy-mm-dd', "minDate"=>"16-04-01"));
  956.  
  957. // to perfor contains search, uncomment following - will disable datepicker
  958. // $col["searchoptions"]["sopt"] = array("cn");
  959. // search date in format Jan 23, 2008
  960. // $col["dbname"] = "date_format(invdate,'%b %d, %Y')";
  961.  
  962. $cols[] = $col;
  963.  
  964. ////////////////////////
  965. ////////////////////////
  966.  
  967. $col = array();
  968. $col["title"] = "UPD By";
  969. $col["name"] = "updated_by";
  970. $col["width"] = "30";
  971. $col["align"] = "center"; // this column is not editable
  972. $col["sortable"] = true; // this column is not sortable
  973. $col["search"] = true; // this column is not searchable
  974. $col["editable"] = false;
  975. $col["hidden"] = true; // HIDE this column
  976. //$col["editrules"] = array("edithidden"=>true);
  977. $cols[] = $col;
  978.  
  979.  
  980. //////////
  981. /////////
  982.  
  983. $col = array();
  984. $col["title"] = "UPD Date";
  985. $col["name"] = "updated_date";
  986. $col["width"] = "40";
  987. $col["align"] = "center"; // this column is not editable
  988. $col["sortable"] = true; // this column is not sortable
  989. $col["search"] = true; // this column is not searchable
  990. $col["editable"] = false;
  991. $col["hidden"] = true; // HIDE this column
  992. //$col["editrules"] = array("edithidden"=>true);
  993. $col["formatter"] = "date";
  994. # opts array can have these options: http://api.jqueryui.com/datepicker/
  995. $col["formatoptions"] = array("srcformat"=>'Y-m-d',"newformat"=>'d.m.y', "opts" => array("changeYear" => true, "dateFormat"=>'yy-mm-dd', "minDate"=>"16-04-01"));
  996.  
  997. // to perfor contains search, uncomment following - will disable datepicker
  998. // $col["searchoptions"]["sopt"] = array("cn");
  999. // search date in format Jan 23, 2008
  1000. // $col["dbname"] = "date_format(invdate,'%b %d, %Y')";
  1001.  
  1002. $cols[] = $col;
  1003.  
  1004. //////////
  1005. /////////
  1006.  
  1007. $col = array();
  1008. $col["title"] = "CRT By";
  1009. $col["name"] = "created_by";
  1010. $col["width"] = "30";
  1011. $col["align"] = "center";
  1012. $col["sortable"] = true; // this column is not sortable
  1013. $col["search"] = true; // this column is not searchable
  1014. $col["editable"] = false;
  1015. $col["hidden"] = true; // HIDE this column
  1016. //$col["editrules"] = array("edithidden"=>true);
  1017. $cols[] = $col;
  1018.  
  1019. ////////////////////////
  1020. ////////////////////////
  1021.  
  1022. $col = array();
  1023. $col["title"] = "FWUP OP";
  1024. $col["name"] = "follow_up_operator";
  1025. $col["width"] = "50";
  1026. $col["align"] = "center"; // this column is not editable
  1027. $col["sortable"] = true; // this column is not sortable
  1028. $col["search"] = true; // this column is not searchable
  1029.  
  1030. $col["dbname"] = "ops.operator_id"; // this is required as we need to search in name field, not id
  1031. $col["editable"] = true;
  1032.  
  1033. # fetch data from database, with alias k for key, v for value
  1034. $str = $g->get_dropdown_values("select distinct operator_id as k, operator_name as v from crm_operators ORDER BY operator_name");
  1035.  
  1036. $col["edittype"] = "select"; // render as select
  1037. $col["editoptions"] = array("value"=>$str, "defaultValue" => "Select");
  1038. $col["editoptions"]["dataInit"] = "function(){ setTimeout(function(){ link_select2('{$col["name"]}'); },200); }";
  1039.  
  1040. $col["stype"] = "select"; // render as select
  1041. $col["searchoptions"] = array("value"=>$str);
  1042. $col["searchoptions"]["dataInit"] = "function(){ setTimeout(function(){ link_select2('gs_{$col["name"]}'); },200); }";
  1043.  
  1044. $cols[] = $col;
  1045.  
  1046.  
  1047. //////////
  1048. /////////
  1049.  
  1050. $col = array();
  1051. $col["title"] = "Checked";
  1052. $col["name"] = "checked";
  1053. $col["width"] = "25";
  1054. $col["align"] = "center"; // this column is not editable
  1055. $col["sortable"] = true; // this column is not sortable
  1056. $col["search"] = true; // this column is not searchable
  1057.  
  1058. $col["dbname"] = "checked"; // this is required as we need to search in name field, not id
  1059. $col["editable"] = true;
  1060.  
  1061. //# fetch data from database, with alias k for key, v for value
  1062. //$str = $g->get_dropdown_values("select distinct status_id as k, status_name as v from crm_status ORDER BY status_id");
  1063. $str = "Yes:Yes;No:No";
  1064.  
  1065. $col["edittype"] = "select"; // render as select
  1066. $col["editoptions"] = array("value"=>$str, "defaultValue" => "No");
  1067. $col["editoptions"]["dataInit"] = "function(){ setTimeout(function(){ link_select2('{$col["name"]}'); },200); }";
  1068.  
  1069. $col["stype"] = "select"; // render as select
  1070. $col["searchoptions"] = array("value"=>$str);
  1071. $col["searchoptions"]["dataInit"] = "function(){ setTimeout(function(){ link_select2('gs_{$col["name"]}'); },200); }";
  1072.  
  1073. $cols[] = $col;
  1074.  
  1075. //////////
  1076. /////////
  1077.  
  1078.  
  1079. // pass the cooked columns to grid
  1080. $g3->set_columns($cols);
  1081.  
  1082. // generate grid output, with unique grid name as 'list1'
  1083. $g3->table = "crm_log";
  1084. $out_list3 = $g3->render("list3");
  1085.  
  1086.  
  1087.  
  1088.  
  1089. ////// END Detail Grid 03
  1090. ////////////////////////////////////////////////////////////////
  1091. ////////////////////////////////////////////////////////////////
  1092. ?>
  1093.  
  1094.  
  1095. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
  1096. <html>
  1097. <head>
  1098. <link rel="stylesheet" type="text/css" media="screen" href="lib/js/themes/redmond/jquery-ui.custom.css"></link>
  1099. <link rel="stylesheet" type="text/css" media="screen" href="lib/js/jqgrid/css/ui.jqgrid.css"></link>
  1100.  
  1101. <script src="lib/js/jquery.min.js" type="text/javascript"></script>
  1102. <script src="lib/js/jqgrid/js/i18n/grid.locale-en.js" type="text/javascript"></script>
  1103. <script src="lib/js/jqgrid/js/jquery.jqGrid.min.js" type="text/javascript"></script>
  1104. <script src="lib/js/themes/jquery-ui.custom.min.js" type="text/javascript"></script>
  1105.  
  1106. <!--link href="lib/js/integration/select2/select2.css" rel="stylesheet"/>
  1107. <script src="lib/js/integration/select2/select2.min.js"></script-->
  1108.  
  1109. <link rel="stylesheet" href="//cdn.jsdelivr.net/select2/3.5.2/select2.css">
  1110. <script src="//cdn.jsdelivr.net/select2/3.5.2/select2.min.js"></script>
  1111.  
  1112. </head>
  1113. <body>
  1114. <div style="margin:10px">
  1115.  
  1116.  
  1117. <?php echo $out_master ?>
  1118. <br>
  1119.  
  1120. <div style="float:left">
  1121. <?php echo $out_list2?>
  1122. </div>
  1123.  
  1124. <div style="float:left; margin-left:10px">
  1125. <?php echo $out_list3?>
  1126. </div>
  1127.  
  1128. </div>
  1129.  
  1130.  
  1131. <script>
  1132. function grid_onloadGrid01(ids)
  1133. {
  1134. // get row ids from grid (with id: list1)
  1135. var ids = $("#list1").jqGrid('getDataIDs');
  1136. setTimeout( function(){ jQuery("#list1").jqGrid('setSelection', ids[0], true); },2200);
  1137.  
  1138. var grid = $("#list1");
  1139. var ids = grid.jqGrid('getDataIDs');
  1140. for (var i=0;i<ids.length;i++)
  1141. {
  1142. var id=ids[i];
  1143. if (grid.jqGrid('getCell',id,'color_id') == 'Red')
  1144. {
  1145. grid.jqGrid('setCell',id,'cie_name','',{'background-color':'rgba(255,0,0, 0.2)'});
  1146. grid.jqGrid('setCell',id,'color_id','',{'background-color':'rgba(255,0,0, 0.2)'});
  1147. }
  1148.  
  1149. if (grid.jqGrid('getCell',id,'color_id') == 'Green')
  1150. {
  1151. grid.jqGrid('setCell',id,'cie_name','',{'background-color':'rgba(0,255,0, 0.2)'});
  1152. grid.jqGrid('setCell',id,'color_id','',{'background-color':'rgba(0,255,0, 0.2)'});
  1153. }
  1154.  
  1155. if (grid.jqGrid('getCell',id,'color_id') == 'Yellow')
  1156. {
  1157. grid.jqGrid('setCell',id,'cie_name','',{'background-color':'rgba(247,255,40, 0.5)'});
  1158. grid.jqGrid('setCell',id,'color_id','',{'background-color':'rgba(247,255,40, 0.5)'});
  1159.  
  1160. }
  1161.  
  1162. }
  1163.  
  1164.  
  1165. }
  1166. </script>
  1167.  
  1168.  
  1169. <script>
  1170. function open_edit(o)
  1171. {
  1172. var rowid = jQuery(o).closest('tr').attr('id');
  1173. jQuery("#list1").jqGrid().setSelection(rowid);
  1174. jQuery("#edit_list1").click();
  1175. }
  1176. </script>
  1177.  
  1178.  
  1179. <script>
  1180. function open_editGrid2(o)
  1181. {
  1182. var rowid = jQuery(o).closest('tr').attr('id');
  1183. jQuery("#list2").jqGrid().setSelection(rowid);
  1184. jQuery("#edit_list2").click();
  1185. }
  1186. </script>
  1187.  
  1188.  
  1189. <script>
  1190. function open_editGrid3(o)
  1191. {
  1192. var rowid = jQuery(o).closest('tr').attr('id');
  1193. jQuery("#list3").jqGrid().setSelection(rowid);
  1194. jQuery("#edit_list3").click();
  1195. }
  1196. </script>
  1197.  
  1198.  
  1199. <script>
  1200. function link_select2(id)
  1201. {
  1202. $('select[name='+id+'].editable, select[id='+id+']').select2({width:'95%', dropdownCssClass: 'ui-widget ui-jqdialog', onSelect: function(){ jQuery(this).trigger('change'); }});
  1203. $(document).unbind('keypress').unbind('keydown');
  1204. }
  1205. </script>
  1206.  
  1207.  
  1208.  
  1209. </body>
  1210. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement