php - Trying to show jqmobile grid(trirand) in a jquery mobile windows -
using jquery mobile want pop dialog box user can enter in search filters , when submit query show jqmobile grid(trirand) inside modal window. possible. here code below:
qr.php
<?php require_once '../auth.php'; require_once '../jqsuitephp/jq-config.php'; // include pdo driver class require_once '../../jqsuitephp/php/jqgridpdo.php'; // connection server $conn = new pdo(db_dsn,db_user,db_password); // tell db use utf-8 $conn->query("set names utf8"); if(isset($_request['a'])) { //get asset information $conn = new pdo(db_dsn,db_user,db_password); $sql = "select asset_no, dept_id dept, short_desc, `loto #` loto mfg_eng_common.machine asset_no ='".$_request['a']."'"; $result = $conn->query($sql); $row = $result->fetch(pdo::fetch_assoc); //check see if active work order exists in mwo system current asset //status_id of 50 mean approved/closed $sql = "select count(*) wocnt mfg_eng_mwo.mwo asset_id ='".$_request['a']."' , status_id != 50"; $result = $conn->query($sql); $wocnt = $result->fetch(pdo::fetch_assoc); } else { header("location: http://rworley-laptop.dayton-phoenix.com/dpg/mwo/forms/mwo.php"); } ?> <!doctype html> <html lang="en-us"> <head> <link rel="stylesheet" href="http://code.jquery.com/mobile/1.3.1/jquery.mobile-1.3.1.min.css" /> <script src="http://code.jquery.com/jquery-1.9.1.min.js"></script> <script src="http://code.jquery.com/mobile/1.3.1/jquery.mobile-1.3.1.min.js"></script> <script type="text/javascript"> function getwocnt() { var cntval = <?php echo $wocnt['wocnt'];?>; if(cntval > 0) { if (confirm(" there active work order(s) asset <?php echo $_request['a']?>. \n see active work orders:\n click cancel , click 'update work orders'. \n\n enter new work order asset <?php echo $_request['a']?> \n click ok .")) { window.open("../forms/mwo.php?a=<?php echo $_request['a']?>", "new"); /* $(function () { $("#newmwo").on('click', (function (event) { event.preventdefault(); var loadvars=(encodeuri("../forms/mwo.php?a=<?php echo $_request['a']?>")); var dialogname= $("#mwoform").load(loadvars); $(dialogname).dialog({ autoopen: false, resizable: true, modal: true, bigframe: true, height: 600, width: 1000, overflow: scroll, resizable: true, title: "mwo new work order" }); dialogname.dialog('open'); return false; })); }); */ } } else { window.open("../forms/mwo.php?a=<?php echo $_request['a']?>", "new"); /* $(function () { $("#newmwo").on('click', (function (event) { event.preventdefault(); var loadvars=(encodeuri("../forms/mwo.php?a=<?php echo $_request['a']?>")); var dialogname= $("#mwoform").load(loadvars); $(dialogname).dialog({ autoopen: false, resizable: true, modal: true, bigframe: true, height: 600, width: 1000, overflow: scroll, resizable: true, title: "mwo new work order" }); dialogname.dialog('open'); return false; })); }); */ } }; </script> </head> <body> <div data-role="page" data-theme="b" align="center"> <div data-theme="a" data-role="header"> <h1>maintenance work orders</h1> <img alt="<?php echo $_request['a']?>" src="../../machine pictures/<?php echo $row['dept']?>/<?php echo $row['asset_no']?>.jpg" height="240" width="300"/> <b><br><?php echo $row['short_desc']?></b> </div><!-- /header --> <br> <div data-theme="c" data-content-theme="d" > <hr> <a href="../../pmprocedures/<?php echo $_request['a']?>.pdf" target="_blank"><?php echo "pm procedure" ?></a> <b>|</b> <a href="../../loto/<?php echo $row['loto']?>.pdf" target="_blank"><?php echo "loto procedure" ?></a> </div> <div data-role="collapsible-set" data-theme="b" data-content-theme="d" > <ul data-role="listview" data-inset="true" align="center" data-filter="false" data-theme="b"> <li> <a id="newmwo" name="newmwo" data-role="button" data-inline="true" target="_blank" onclick=getwocnt() > new work order </a> </li> </ul> <ul data-role="listview" data-inset="true" align="center" data-filter="false" data-theme="b"> <li> <a href="updatework.php?a=<?php echo $_request['a']?>" data-role="button" data-inline="true" data-rel="dialog" data-transition="slidedown"> update work order </a> </li> </ul> <ul data-role="listview" data-inset="true" align="center" data-filter="false" data-theme="b"> <li> <a href="../../mwo/mwo_mobile.php?a=<?php echo $_request['a']?>" data-role="button" data-inline="true" data-rel="dialog" target="mwosearch" data-transition="slidedown" > search work orders </a> </li> </ul> </div> <?php if(!($_post)) { echo " <a href='#popupbasic' data-rel='popup' data-role='button' data-inline='true'>quick search</a> <div data-role='popup' id='popupbasic' data-transition='flip' > <a href='#' data-rel='back' data-role='button' data-theme='a' data-icon='delete' data-iconpos='notext' class='ui-btn-right'>close</a> <form action='#' method='post'> <div data-theme='a' data-role='header'> <h2>look mwo</h2> </div> <p> problem<textarea name='search_prob' data-theme = 'a' data-content-theme = 'd' rows = '3' cols = '50' id = 'search_prob' /></textarea> </p> <p> solution<textarea name='search_sol' data-theme = 'a' data-content-theme = 'd' rows = '3' cols = '50' id = 'search_sol' /></textarea> </p> <p id = 'submit-area'> <input type='submit' data-theme='b' value='search' id = 'sub1'/> </p> </form> </div> "; } else { echo " <ul data-role='listview' data-inset='true' align='center' data-filter='false' data-theme='b'> <li> <a href=\"qs.php?a=".$_request['a']."\" data-role='button' data-inline='true' data-rel='dialog' data-transition='slidedown'> qucick search results </a> </li> </ul>"; } ?> <div data-role="footer" data-theme="a"> <h4>dayton-phoenix group, inc.</h4> </div><!-- footer --> </div><!-- page --> </body> </html>
qs.php
<!doctype html> <html> <head> <meta charset="utf-8"/> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>mwo quick search</title> <link rel="stylesheet" href="../../jquerymobile.jqgrid/css/themes/default/jquery.mobile.css" /> <link rel="stylesheet" href="../../jquerymobile.jqgrid/css/themes/ui.jqgridmobile.css" /> <link rel="stylesheet" href="../../jquerymobile.jqgrid/css/themes/shcoreeclipse.css" /> <link rel="stylesheet" href="../../jquerymobile.jqgrid/css/themes/shthemeeclipse.css" /> <script src="../../jquerymobile.jqgrid/js/jquery.js" type="text/javascript"></script> <script src="../../jquerymobile.jqgrid/js/jquerymobile.jqgrid.min.js" type="text/javascript"></script> <script src="../../jquerymobile.jqgrid/js/jquery.mobile.js" type="text/javascript"></script> <script src="../../jquerymobile.jqgrid/js/grid.locale-en.js" type="text/javascript"></script> </head> <body> <a href="quicksearch2.php?a=<?php echo $_request['a'];?>&search_prob=<?php echo $_request['search_prob']; ?>">paging, sorting , searching</a> </body> </html>
quicksearch2.php
<!doctype html> <html> <body> <div id="page" data-role="page" data-theme="b"> <div data-role="header" data-theme="b" style="margin-bottom: 10px"> <h1> mwo quick search results</h1> <a href="../indexhtml.html" data-icon="home" data-iconpos="notext" data-direction="reverse">home</a> </div> <!-- html table definition --> <table id='grid'></table> <div id='pager'></div> <!-- java scruipt code --> <script type='text/javascript'> var = <?php echo json_encode($_request['a']); ?>; var prob = <?php echo json_encode($_request['search_prob']); ?>; jquery('#grid').jqgrid({ "hoverrows":false, "viewrecords":true, //"jsonreader":{"repeatitems":false,"subgrid":{"repeatitems":false}}, "gridview":true, "url":"../../mwo/mobile/quicksearch.php?a=" + + "&search_prob=" + prob, "loadonce": true, "rownum":10, "height":200, "autowidth":true, "sortname":"mwo_id", "rowlist":[10,30,40], "datatype":"json", "colmodel":[ {"name":"e", "index":"empty", "sorttype":"int", "hidden":true,"width":50,"editable":true}, {"name":"mwo #", "index":"mwo_id", "sorttype":"int", "key":true,"width":80,"editable":true}, {"name":"dpg #", "index":"asset_id", "sorttype":"string", "width":80, "editable":true}, {"name":"assigned to", "index":"assigned_id", "sorttype":"string", "width":80, "editable":true}, {"name":"entered", "index":"entered_time", "sorttype":"datetime", "width":80, "editable":true,"datefmt":"m/d/y", "searchoptions":{sopt:['eq']}, "formatter":"date","formatoptions":{"srcformat":"y-m-d h:i:s","newformat":"m/d/y"}}, {"name":"problem", "index":"long_desc", "sorttype":"string", "width":80, "editable":true}, {"name":"solution", "index":"solution", "sorttype":"string", "width":80, "editable":true} ], "pager":"#pager" }); </script> </div> </body> </html>
json data being used:
{"page":1,"total":2,"records":13,"rows":[{"mwo_id":"1302271211","cell":["","1302271211","38315","-1","2013-07-08 11:13:19","approved test",""]},{"mwo_id":"1302271213","cell":["","1302271213","38315","-1","2013-07-11 09:26:26","yo momma fattest","how fat she? she's fat left house in heels , came in flip-flops"]},{"mwo_id":"1302271214","cell":["","1302271214","38315","-1","2013-07-12 12:13:55","july test",""]},{"mwo_id":"1302271215","cell":["","1302271215","38315","-1","2013-07-08 08:59:56","test","update2"]},{"mwo_id":"1302271216","cell":["","1302271216","38315","-1","2013-07-09 06:14:02","test",""]},{"mwo_id":"1302271217","cell":["","1302271217","38315","-1","2013-07-08 09:01:30","yep testing","no answer yet"]},{"mwo_id":"1302271218","cell":["","1302271218","38315","-1","2013-07-09 09:59:46","new test of email system",""]},{"mwo_id":"1302271219","cell":["","1302271219","38315","","2013-07-08 12:33:09","email new test",""]},{"mwo_id":"1302271221","cell":["","1302271221","38315","12","2013-07-11 13:20:55","another test of new ...with email","and answer ....."]},{"mwo_id":"1302271222","cell":["","1302271222","38315","","2013-07-11 09:29:58","test...add issue",""]},{"mwo_id":"1302271223","cell":["","1302271223","38315","","2013-07-11 13:11:15","testing",""]},{"mwo_id":"1302271224","cell":["","1302271224","38315","7","2013-07-11 13:27:32","test auto assign","no solution good"]},{"mwo_id":"1302271226","cell":["","1302271226","38315","7","2013-07-12 12:05:02","meeting test",""]}]}
Comments
Post a Comment