Strider Posted March 21, 2013 Author Report Posted March 21, 2013 IT always works for me, when it is on top. Quote
Txmmy83 Posted March 21, 2013 Report Posted March 21, 2013 pagination works now http://www.flyeurope-va.org/index.php/schedules/view idiot error: my datatables.js was not there where it should have been so it could never be reached Quote
Tato123 Posted May 20, 2013 Report Posted May 20, 2013 hello guys I tried to run the scrip on my site but nothing. Someone can help me? i copy the file jquery.js jquery.dataTables.js jquery.dataTables.min.js in lib/js/ i copy the image in: in lib/images This is my core_htmlhead.tpl ?> <script type="text/javascript"> var baseurl = "<?php echo SITE_URL;?>"; var geourl = "<?php echo GEONAME_URL; ?>"; </script> <link rel="stylesheet" media="all" type="text/css" href="<?php echo fileurl('lib/css/phpvms.css')?>" /> <meta http-equiv="Content-Type" content="text/html; charset=<?php echo Config::Get('PAGE_ENCODING');?>" /> <script type="text/javascript" src="http://ajax.googleap...n.js"></script> <script type="text/javascript" src="http://ajax.googleap...n.js"></script> <script type="text/javascript" src="http://maps.google.c...true"></script> <script type="text/javascript" src="<?php echo fileurl('lib/js/jquery.form.js');?>"></script> <script type="text/javascript" src="<?php echo fileurl('lib/js/phpvms.js');?>"></script> <script type="text/javascript" src="<?php echo fileurl('lib/js/jquery_dataTables.js');?>"></script> <?php echo $MODULE_HEAD_INC; This is my schedule_result.tpl <script type="text/javascript"> $(document).ready(function() { $('#tabledlist').dataTable( { "sPaginationType": "full_numbers" } ); } ); </script> <table id="tabledlist" class="display""> <thead> <tr> <th>Flight Info</th> <th>Info</th> </tr> </thead> <tbody> <?php if(!$allroutes) { echo '<p align="center">No routes have been found!</p>'; return; } ?> <tbody> <?php foreach($allroutes as $route) { /* Uncomment this code if you want only schedules which are from the last PIREP that pilot filed */ /*if(Auth::LoggedIn()) { $search = array( 'p.pilotid' => Auth::$userinfo->pilotid, 'p.accepted' => PIREP_ACCEPTED ); $reports = PIREPData::findPIREPS($search, 1); // return only one if(is_object($reports)) { # IF the arrival airport doesn't match the departure airport if($reports->arricao != $route->depicao) { continue; } } }*/ /* Skip over a route if it's not for this day of week Left this here, so it can be omitted if your VA doesn't use this. Comment out these two lines if you don't want to. */ /* Check if a 7 is being used for Sunday, since PHP thinks 0 is Sunday */ $route->daysofweek = str_replace('7', '0', $route->daysofweek); if(strpos($route->daysofweek, date('w')) === false) continue; /* END DAY OF WEEK CHECK */ /* This will skip over a schedule if it's been bid on This only runs if the below setting is enabled If you don't want it to skip, then comment out this code below by adding // in front of each line until the END DISABLE SCHEDULE comment below If you do that, and want to show some text when it's been bid on, see the comment below */ if(Config::Get('DISABLE_SCHED_ON_BID') == true && $route->bidid != 0) { continue; } /* END DISABLE SCHEDULE ON BID */ /* Skip any schedules which have aircraft that the pilot is not rated to fly (according to RANK), only skip them if they are logged in. */ if(Config::Get('RESTRICT_AIRCRAFT_RANKS') === true && Auth::LoggedIn()) { /* This means the aircraft rank level is higher than what the pilot's ranklevel, so just do "continue" and move onto the next route in the list */ if($route->aircraftlevel > Auth::$userinfo->ranklevel) { continue; } } /* THIS BEGINS ONE TABLE ROW */ ?> <tr> <td><a href="<?php echo url('/schedules/details/'.$route->id);?>"><?php echo '('.$route->depicao.' - '.$route->arricao.')'?><?php echo $route->code . $route->flightnum?></a></td> <td nowrap> </td> </tr> <tr> <td><strong>Departure: </strong><?php echo $route->deptime;?> <strong>Arrival: </strong><?php echo $route->arrtime;?></td> <td nowrap><a href="<?php echo url('/schedules/details/'.$route->id);?>">View Details</a></td> </tr> <tr> <td><strong>Equipment: </strong><?php echo $route->aircraft; ?> (<?php echo $route->registration;?>) <strong>Distance: </strong><?php echo $route->distance . Config::Get('UNITS');?></td> <td nowrap><a href="<?php echo url('/schedules/brief/'.$route->id);?>">Pilot Brief</a></td> </tr> <tr> <td><strong>Days Flown: </strong><?php echo Util::GetDaysCompact($route->daysofweek); ?></td> <td nowrap><?php # Don't allow overlapping bids and a bid exists if(Config::Get('DISABLE_SCHED_ON_BID') == true && $route->bidid != 0) { ?> <a id="<?php echo $route->id; ?>" class="addbid" href="<?php echo actionurl('/schedules/addbid');?>">Add to Bid</a> <?php } else { if(Auth::LoggedIn()) { ?> <a id="<?php echo $route->id; ?>" class="addbid" href="<?php echo url('/schedules/addbid');?>">Add to Bid</a> <?php } } ?></td> </tr> <tr> <td><br /> <?php echo ($route->route=='') ? '' : '<strong>Route: </strong>'.$route->route.'<br />' ?> <?php echo ($route->notes=='') ? '' : '<strong>Notes: </strong>'.html_entity_decode($route->notes).'<br />' ?> <?php # Note: this will only show if the above code to # skip the schedule is commented out if($route->bidid != 0) { echo 'This route has been bid on'; } ?> </td> <td nowrap><br /> <br /></td> </tr> <?php /* END OF ONE TABLE ROW */ } ?> </tbody> </table> <hr> Quote
Strider Posted May 20, 2013 Author Report Posted May 20, 2013 you have put an underscore in the part where it is calling the JS file. it should be jquery.datatables.js. not jquery_datatables.js Quote
Kalo Posted January 1, 2014 Report Posted January 1, 2014 Hmm I haven't got it to work. Any suggestions? I copied the three .js files to lib/js i copies the images to lib/images and I put the two template files to core/templates This is what the top of my schedule_results.tpl file looks like: http://pastebin.com/mftXxdxV I just used the default table listed in there which was named "tabledlist". Should I be editing tables somewhere else besides this schedule_results.tpl file? And this is what my core_htmlhead.tpl js links looks like: http://pastebin.com/7czH44dx Thanks for anyhelp! Quote
Strider Posted January 2, 2014 Author Report Posted January 2, 2014 put <div> before the opening of the table and </div> after the closing tag of the table. Quote
Kalo Posted January 6, 2014 Report Posted January 6, 2014 put <div> before the opening of the table and </div> after the closing tag of the table. hmm did not work...the table was very large did I put the <div>'s in the right spot? : http://pastebin.com/trJ0VxuR Quote
Strider Posted January 19, 2014 Author Report Posted January 19, 2014 Try getting the link for an updated jquery, that might help. Try this: <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script> Quote
clock Posted June 13, 2014 Report Posted June 13, 2014 I am looking for the images and css used in this please Pagination is working fine but cannot find the images and css on the website indicated Help would be appreciated Quote
in2tech Posted June 30, 2016 Report Posted June 30, 2016 Does anyone know how to change the Pagination Numbers in the Datatable database files? The drop down number: 10 20 50 http://screencast.com/t/u9jjkK0j6TMp Thanks! Quote
web541 Posted June 30, 2016 Report Posted June 30, 2016 (edited) In your ___.dataTable{[ javascript function, place this "lengthMenu": [ [10, 20, 50], [10, 20, 50]] Edited June 30, 2016 by web541 Quote
in2tech Posted July 1, 2016 Report Posted July 1, 2016 (edited) web541, Where do I place this code? In the jquery.dataTables.js or in my code on the page? And if in the jQuery.dataTables.js which line is it. I have looked every where in that code! <script type="text/javascript"> $(document).ready(function() { $('.table').dataTable( { "sPaginationType": "full_numbers" } ); } ); </script> Thanks, brand new to this! I am also having trouble with the No Routes Passed on the schedule_results page. And I am using this for the pagination css and it's causing the No Routes Passed, on the schedules page, works on the pilot list and view all pireps. Works on the schedules results but no styling: http://screencast.com/t/AAgPFyoa0q When I get the styling too work, there is the No Routes Passed code on the Schedule Results page: http://screencast.com/t/M4vXDiTazi71 These are the 2 links I got off of the DataTables website: <link rel="stylesheet" type="text/css" href="https://cdn.datatabl...trap.min.css"/> <script type="text/javascript" src="https://cdn.datatabl...n.js"></script> Image of the links: http://screencast.com/t/NDuAe8mCsO https://datatables.n.../bootstrap.html Thanks! Edited July 1, 2016 by jnascar Quote
web541 Posted July 1, 2016 Report Posted July 1, 2016 You put that code I gave you in your code on the page Assuming it was the above code, I've modified it for you <script type="text/javascript"> $(document).ready(function() { $('.table').dataTable({ "sPaginationType": "full_numbers", "lengthMenu": "[ [10, 20, 50], [10, 20, 50] ]" }); }); </script> As for the "no route passed" error, do a search on the forums, it's a common problem, usually based with a jQuery problem, so check that in your skin, the only place you've specified it is in your core_htmlhead.php file. If that doesn't work, I've found in the past that the best solution is this one http://forum.phpvms.net/topic/7431-no-route-passed-solved/#entry49472 Quote
in2tech Posted July 1, 2016 Report Posted July 1, 2016 (edited) Your code caused this: http://screencast.com/t/9UZs7HH2HBa Any ideas? I mean I can click on the individual number like 2, 5, but the 10, 20, 50 is a no go. I actually want to change them to like 5,10,20, etc.... You have it working better than I did And I see code here on the dataTables page: https://datatables.n...tion/lengthMenu But i am not sure how to implement it! Thanks! Got it working! Thank you so much web541, I really appreciate it, more than you know! Now to get that pesky Route Passed stuff working This is what I used off the site and modified it: <script type="text/javascript"> $(document).ready(function() { $('.table').dataTable({ "sPaginationType": "full_numbers", "lengthMenu": [ [5, 10, 15, -1], [5, 10, 15, "All"] ] }); }); </script> I think your code was just missing a bracket, I think Here it is working: http://screencast.com/t/x18iKQki And you can have different options on different pages....awesome! http://screencast.com/t/sk67zEHK5U Once again, many thanks! Now to get it to work on the schedules results page as this is where it shines, as there are so many schedules on sites. And the searching for airports and other options is awesome. Darn No Routes Passed, always causing a problem. Have to get it working! http://screencast.com/t/FSkhYjgGT Edited July 1, 2016 by jnascar Quote
in2tech Posted July 4, 2016 Report Posted July 4, 2016 Alright besides the No Routes Passed on the schedule results page (what a pain), I having it working on most pages, and now I am trying to get it working on a page with multiple tables. There is a Datatable code for this but I can not get it to work yet on the phpVMS site, except for the test pagination page on my phpVMS site, that it is working on with multiple tables perfectly. On my test pagination page I have 3 tables and they work independently of each other. Meaning I can sort each one separately and also search each one independently of each other, but I can not get it to work on my actual phpVMS page. Here is the datatable code for multiple tables on one page: <script> $(document).ready(function() { $('table.table').DataTable(); } ); </script> <table class="table"> All 3 tables have the same class and work perfectly. Just can not figure out why the page I am working on does not work yet. I even tried a table ID and than a table class like: <script> $(document).ready(function() { $('#fleet.table').DataTable(); } ); </script> <table id="fleet" class="table"> And this did not work. There is another table on the page, but I gave it a separate table ID as not to confuse the Datatable code. Confused again, Thanks for your help! Does anyone have this working with multiple tables on the same page? Quote
web541 Posted July 4, 2016 Report Posted July 4, 2016 (edited) Try this? <script> // Separate each dataTable into their own function to target them only $(document).ready(function() { $('#idhere').dataTable(); }); $(document).ready(function() { $('#fleet').dataTable(); }); // Or even this one, but I recommend using the id's otherwise every table on the page will be datatables $(document).ready(function() { $('.table').dataTable(); }); </script> And here are your table tags <table id="idhere" class="table"> <table id="fleet" class="table"> <table class="table"> Edited July 4, 2016 by web541 Quote
Industrialshadow Posted September 8, 2016 Report Posted September 8, 2016 Hello Guys have anybody Time and can help me to bring the pagiantion up in my Codeshare? Im not sure what i have to do so im not a reday for jquery. The Code so i have put in in my Codeshare but the other files i need Help Thanks Quote
Industrialshadow Posted September 12, 2016 Report Posted September 12, 2016 (edited) solved. pagination now working Edited September 12, 2016 by Industrialshadow Quote
flyalaska Posted January 27, 2017 Report Posted January 27, 2017 I know this an old post. I have a small issue. I am able to get this to work. However it is not list the pilots in order. We have reached our pilot number over 1ooo so all all the 1000's are in front of the lower numbers. Any idea how to fix this? Quote
in2tech Posted January 27, 2017 Report Posted January 27, 2017 flyalaska, Are you using the DataTables pagination or some other pagination? The DataTables code should work. Can you show us what you are using in your code? Quote
flyalaska Posted January 27, 2017 Report Posted January 27, 2017 (edited) Yes datatables <script type="text/javascript"> $(document).ready(function() { $('#plist').DataTable(); } ); </script> http://www.flyaka.com/index.php/Pilots Edited January 27, 2017 by flyalaska Quote
in2tech Posted January 27, 2017 Report Posted January 27, 2017 (edited) Please make a BACKUP before trying any of my suggestions! At the beginning of your table, right below the DataTable script what do you have? Since you are using #plist , if I am not mistaken you should have: <table class="plist"> Here is mine for pireps_viewall.php ( Of course I do not have over 1,000 pilots on my test server but I am going to try and see if I can change the number higher somehow) Of course it is not BOLD I just did that to show you the matching code! This also lets you change the drop down number selections. BTW, thanks to web541for helping me out originally. I also have this code on the top of each page because I am lazy, to activate the code: <link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.10.12/css/dataTables.bootstrap.min.css"/> <script type="text/javascript" src="https://cdn.datatables.net/v/bs/jq-2.2.3/dt-1.10.12/datatables.min.js"></script> <script type="text/javascript"> $(document).ready(function() { $('#pireps').dataTable({ "sPaginationType": "full_numbers", "lengthMenu": [ [15, 30, 60, -1], [15, 30, 60, "All"] ] }); }); </script> <table id="pireps" class="table"> It works in the data tables example, under the salary ( not exactly like mine ). I can't imagine the AKA prefix would make a difference, but not sure. https://www.datatables.net BTW, if you get it working there is also code where you can select which column to sort by default. It looks like yours is by Pilot ID! I know that also messed me up one time. Somehow I had my table sorting by default in a column I did not want it too. Edited January 27, 2017 by jnascar Quote
web541 Posted January 27, 2017 Report Posted January 27, 2017 Another option would be to make a json response from the 'Pilot Module' and check the length of the pilotid, if it's shorter than four, append a zero to it before the number so 996 would be 0996, then 1000, not ideal, but it should work. Then you can re-route datatables to read this. Quote
flyalaska Posted January 27, 2017 Report Posted January 27, 2017 1 hour ago, jnascar said: Please make a BACKUP before trying any of my suggestions! At the beginning of your table, right below the DataTable script what do you have? Since you are using #plist , if I am not mistaken you should have: <table class="plist"> Here is mine for pireps_viewall.php ( Of course I do not have over 1,000 pilots on my test server but I am going to try and see if I can change the number higher somehow) Of course it is not BOLD I just did that to show you the matching code! This also lets you change the drop down number selections. BTW, thanks to web541for helping me out originally. I also have this code on the top of each page because I am lazy, to activate the code: <link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.10.12/css/dataTables.bootstrap.min.css"/> <script type="text/javascript" src="https://cdn.datatables.net/v/bs/jq-2.2.3/dt-1.10.12/datatables.min.js"></script> <script type="text/javascript"> $(document).ready(function() { $('#pireps').dataTable({ "sPaginationType": "full_numbers", "lengthMenu": [ [15, 30, 60, -1], [15, 30, 60, "All"] ] }); }); </script> <table id="pireps" class="table"> It works in the data tables example, under the salary ( not exactly like mine ). I can't imagine the AKA prefix would make a difference, but not sure. https://www.datatables.net BTW, if you get it working there is also code where you can select which column to sort by default. It looks like yours is by Pilot ID! I know that also messed me up one time. Somehow I had my table sorting by default in a column I did not want it too. Didn't work. I did it the way you did above and got pretty much the same results, with the buttons messed up. http://www.flyaka.com/index.php/Pilots <table id="plist" width="100%" border="0" cellspacing="0" cellpadding="0" class="aka_table"> Quote
in2tech Posted January 27, 2017 Report Posted January 27, 2017 Yeah I changed the id's on my test server and it did not work for me either. However you do need the matching id in the script and the table for it to work correctly. Epic Fail...sorry It doesn't have anything to do with the pilot length code does it. I saw somewhere when searching you can change the pilot id from like 4 to 3 or I guess 4 to 6, or whatever number of places you want. That's not it, is it? Sorry I tried. If I do figure it out, I'll let you know! Or if you figure it out, or someone, let us know how you did it? SBA1030 SBA1040 Not sorting correctly with the other pilot ID's... Quote
in2tech Posted January 27, 2017 Report Posted January 27, 2017 (edited) 1 hour ago, web541 said: Another option would be to make a json response from the 'Pilot Module' and check the length of the pilotid, if it's shorter than four, append a zero to it before the number so 996 would be 0996, then 1000, not ideal, but it should work. Then you can re-route datatables to read this. I think the default number is set to 4. I think! Someone might also mention this in the phpVMS3 area to see if they can avoid this in the new version. Edited January 27, 2017 by jnascar Quote
web541 Posted January 27, 2017 Report Posted January 27, 2017 (edited) No, not the default number sorry, the ordering, because it looks for number then length (I think), 0 comes before 1, so theoretically is you have these 10 20 1000 It will become like this currently 10 1000 20 By if you re-route a zero in front of it, it should become like this 0010 0020 1000 etc, so the id matches the length while still keeping the number there, might look silly, but it works. Edited January 27, 2017 by web541 Quote
in2tech Posted January 27, 2017 Report Posted January 27, 2017 Can you show me and flyalaska the code you are using to get it to work please? Quote
web541 Posted January 28, 2017 Report Posted January 28, 2017 This is how I would do it Add this to your core/modules/Pilots/Pilot.php /*** ** ** Retrieve a list of all pilots ** @return json response ***/ public function getpilotsjson() { $allpilots = PilotData::getAllPilots(); if(!$allpilots) { $allpilots = array(); } # Form the json header $json = array( 'rows' => array() ); # Add each row to the above array foreach($allpilots as $row) { $statuses = Config::get('PILOT_STATUS_TYPES'); foreach ($statuses as $status) { if($row->retired == '0') { $status = '<font color="green">Active</font>'; } elseif($row->retired == '1') { $status = '<font color="red">Inactive</font>'; } elseif($row->retired == '2') { $status = '<font color="red">Banned</font>'; } elseif($row->retired == '3') { $status = '<font color="blue">On Leave</font>'; } else { $status = '<font color="grey">Unknown</font>'; } } $pilotname = $row->firstname.' '.$row->lastname; $pilotid = ''.PilotData::getPilotCode($row->code, $row->pilotid); $rank = '<img src="'.$row->rank_image.'" alt="'.$row->rank.'" />'; $tmp = array( 'pilotid' => $pilotid, 'pilotname' => $pilotname, 'rank' => $rank, 'flights' => $row->totalflights, 'hours' => $row->totalhours, 'status' => $status, ); $json['rows'][] = $tmp; } header("Content-type: text/x-json"); echo json_encode($json); } then in your pilots_list.php file <?php if(!defined('IN_PHPVMS') && IN_PHPVMS !== true) { die(); } ?> <style> .text-center { text-align: center; } </style> <link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.10.12/css/dataTables.bootstrap.min.css"/> <script type="text/javascript" src="https://cdn.datatables.net/v/bs/jq-2.2.3/dt-1.10.12/datatables.min.js"></script> <script type="text/javascript" charset="utf-8"> $(document).ready(function() { $('#pilotslist').dataTable({ lengthMenu: [ [10, 25, 50, -1], [10, 25, 50, "All"] ], ajax: { url: '<?php echo SITE_URL;?>/action.php/Pilots/getpilotsjson', dataSrc: 'rows' }, columns: [ { data: 'pilotid', sClass: "text-center"}, { data: 'pilotname', sClass: "text-center" }, { data: 'rank', sClass: "text-center" }, { data: 'flights', sClass: "text-center" }, { data: 'hours', sClass: "text-center" }, { data: 'status', sClass: "text-center" } ] }); }); </script> <h3><?php echo $title?></h3> <?php if(!$pilot_list) { echo 'There are no pilots!'; return; } ?> <table id="pilotslist"> <thead> <tr> <th class="text-center">Pilot ID</th> <th class="text-center">Name</th> <th class="text-center">Rank</th> <th class="text-center">Flights</th> <th class="text-center">Hours</th> <th class="text-center">Status</th> </tr> </thead> <tbody> <?php /* Dynamically fill this in.... */ ?> </tbody> </table> Feel free to mess around with the css/jQuery stuff at the top to get it working for you, but that's what I use to retrieve it. If that still doesn't work for you, I've done it so that you should be able to go into your local.config.php file and find PILOTID_LENGTH & OFFSET and edit them until you're satisfied. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.