Pete Posted July 28, 2013 Share Posted July 28, 2013 It just occurred to me that it would be amazing to be able to use a datatable for repeaters. I know it's certainly by no means a simple request, but it would definitely be neat and in some cases preferable when handling lots of repeaters or working with certain data types. Just a thought. 3 Link to comment Share on other sites More sharing options...
kongondo Posted July 28, 2013 Share Posted July 28, 2013 How do you mean Pete? Editing repeaters using DT? Link to comment Share on other sites More sharing options...
Pete Posted July 28, 2013 Share Posted July 28, 2013 Yep. I've run into a few scenarios where it's a bit distracting having the field and row headers repeat with every repeater item, plus when using it for tabular data it would be nice to use a datatable to more easily read down a column. I guess really it's a request for a completely different module, but posted here since Soma seems to be a chunk of the way there by already having experience with these things Link to comment Share on other sites More sharing options...
Macrura Posted July 28, 2013 Share Posted July 28, 2013 @Pete - i've been using Diogo's custom admin pages to handle situations with a lot of data that I want to put into a custom table, using dataTables.js, so since this is the results of a selector, i would guess that you could show the repeater data in something like this... 6 Link to comment Share on other sites More sharing options...
kongondo Posted July 29, 2013 Share Posted July 29, 2013 @Pete...something like this? http://processwire.com/talk/topic/4147-excel-like-crud-in-pw-using-handsontable/ Link to comment Share on other sites More sharing options...
landitus Posted August 18, 2013 Share Posted August 18, 2013 @Macrura, I really like what you've done with the products table. Are you using the Datatable module or just the js library with some custom code? I would really like to implement something like this as well. Link to comment Share on other sites More sharing options...
Macrura Posted August 18, 2013 Share Posted August 18, 2013 here's how i setup the custom datatable page: 1.) make a folder in site/templates called admin-custom; inside that i have a css and js folder; in those folders i put all the scripts and stylesheets for datatable (dataTable.css, jquerydataTables.min.js, jquery.uniform.min.js); 2.) make a template in the templates folder, i called it admin-product-table.php; with this code: <table class="table table-bordered" id="dyntable"> <colgroup> <col class="con0" style="align: center; width: 4%" /> <col class="con1" /> <col class="con0" /> <col class="con1" /> <col class="con0" /> <col class="con1" /> <col class="con0" /> <col class="con1" /> </colgroup> <thead> <tr> <th class="head0 nosort"><input type="checkbox" class="checkall" /></th> <th class="head1">Parent Product</th> <th class="head0">Series</th> <th class="head1">Part #</th> <th class="head0">Room Cu. Ft.</th> <th class="head1">Price Ea.</th> <th class="head0">Missing</th> </tr> </thead> <?php $products = $pages->find('template=product-child,sort=title|series'); foreach ($products as $product) { ?> <tr class="gradeX"> <td class="aligncenter"><span class="center"><input type="checkbox" /></span></td> <td> <a href="<?php echo $config->urls->admin; ?>page/edit/?id=<?php echo $product->parent->id ?>" target="_blank"> <?php echo $product->parent->title ?> </a> </td> <td><?php if($product->product_series) {echo $product->product_series;} else {echo 'n/a';} ?></td> <td> <a href="<?php echo $config->urls->admin; ?>page/edit/?id=<?php echo $product->id ?>" target="_blank"> <?php echo $product->title ?> </a> </td> <td> <?php if($product->roomsize_min && $product->roomsize_max) {echo $product->roomsize_min . '-' . $product->roomsize_max;} else echo 'n/a'; ?> </td> <td class="price">$<?php echo $product->product_price; ?></td> <td> <?php if(!$product->speaker_sensitivity) { echo '<span style="color:lime">Sensitivity</span>'; } ?> </td> </tr> <?php } ?> </tbody> </table> <script> $(document).ready(function(){ // dynamic table if(jQuery('#dyntable').length > 0) { jQuery('#dyntable').dataTable({ "sPaginationType": "full_numbers", "aaSortingFixed": [[0,'asc']], "fnDrawCallback": function(oSettings) { jQuery.uniform.update(); } }); } }); </script> 3.) under the Admin page, create a child page called Products, uses template "admin-products" (which will need the ACP_scripts_and_styles field), and uses alternate template filename of admin. Paste the links to the scripts and stylesheets into the ACP_scripts_and_styles field: site/templates/admin-custom/css/dataTables.css site/templates/admin-custom/js/jquery.dataTables.min.js site/templates/admin-custom/js/jquery.uniform.min.js some of how you set this up will depend on which version of PW you are on – see the ACP documentation about that; in my case i have a child page of Products called Products Table which uses the admin-product-table template; hope that's not too confusing; it's pretty simple, but tricky to explain; most of it you can figure out from the ACP documentation.. 4 Link to comment Share on other sites More sharing options...
landitus Posted August 18, 2013 Share Posted August 18, 2013 Thanks a lot @Macrura! I can't wait to try it out!! Link to comment Share on other sites More sharing options...
NooseLadder Posted December 4, 2013 Share Posted December 4, 2013 Hi, I'm using this module, thanks Soma, I have customised it for a specific report for a client. Everything is ok except I don't understand why in the ProcessDataTable.module under the section // return markup for output I have created a custom field called 'deposit_paid' that is a checkbox. I have the following code: // deposit paid $depositPaid = $p->deposit_paid; if($depositPaid == 'checked') { $depositPaid = 'Yes'; } else { $depositPaid = 'No'; } $sOutput .= '"'.$depositPaid.'",'; But when the table is output the results are reversed in that fields that are checked are set to 'No' and fields that are not checked are set to 'Yes'. If I change if($depositPaid != 'checked') I get the expected output. Maybe it's something simple I am missing (like a few brain cells!!). Link to comment Share on other sites More sharing options...
Soma Posted December 4, 2013 Author Share Posted December 4, 2013 Checkboxes are 0 or 1 not "checked". Link to comment Share on other sites More sharing options...
NooseLadder Posted December 4, 2013 Share Posted December 4, 2013 I said I had some brain cells missing. Thanks Soma. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now