Strict Standards: Declaration of Walker_Page::start_lvl() should be compatible with Walker::start_lvl(&$output) in /home/pramod/public_html/blog/wp-includes/classes.php on line 576 Strict Standards: Declaration of Walker_Page::end_lvl() should be compatible with Walker::end_lvl(&$output) in /home/pramod/public_html/blog/wp-includes/classes.php on line 576 Strict Standards: Declaration of Walker_Page::start_el() should be compatible with Walker::start_el(&$output) in /home/pramod/public_html/blog/wp-includes/classes.php on line 576 Strict Standards: Declaration of Walker_Page::end_el() should be compatible with Walker::end_el(&$output) in /home/pramod/public_html/blog/wp-includes/classes.php on line 576 Strict Standards: Declaration of Walker_PageDropdown::start_el() should be compatible with Walker::start_el(&$output) in /home/pramod/public_html/blog/wp-includes/classes.php on line 593 Strict Standards: Declaration of Walker_Category::start_lvl() should be compatible with Walker::start_lvl(&$output) in /home/pramod/public_html/blog/wp-includes/classes.php on line 687 Strict Standards: Declaration of Walker_Category::end_lvl() should be compatible with Walker::end_lvl(&$output) in /home/pramod/public_html/blog/wp-includes/classes.php on line 687 Strict Standards: Declaration of Walker_Category::start_el() should be compatible with Walker::start_el(&$output) in /home/pramod/public_html/blog/wp-includes/classes.php on line 687 Strict Standards: Declaration of Walker_Category::end_el() should be compatible with Walker::end_el(&$output) in /home/pramod/public_html/blog/wp-includes/classes.php on line 687 Strict Standards: Declaration of Walker_CategoryDropdown::start_el() should be compatible with Walker::start_el(&$output) in /home/pramod/public_html/blog/wp-includes/classes.php on line 710 Strict Standards: Redefining already defined constructor for class wpdb in /home/pramod/public_html/blog/wp-includes/wp-db.php on line 58 Deprecated: Assigning the return value of new by reference is deprecated in /home/pramod/public_html/blog/wp-includes/cache.php on line 99 Strict Standards: Redefining already defined constructor for class WP_Object_Cache in /home/pramod/public_html/blog/wp-includes/cache.php on line 404 Deprecated: Assigning the return value of new by reference is deprecated in /home/pramod/public_html/blog/wp-includes/query.php on line 21 Deprecated: Assigning the return value of new by reference is deprecated in /home/pramod/public_html/blog/wp-includes/theme.php on line 576 Pramod Poudel’s Blog » Blog Archive » Adding Print functionality in Flexigrid Implementation of CodeIgniter

Adding Print functionality in Flexigrid Implementation of CodeIgniter

December 18th, 2009 | by admin |

Add print button in flexgird grid in your Controller.

You should define print css in your flexigrid css.

$buttons[] = array(’separator’);
$buttons[] = array(’Print’,'print’,'printReport’);

Now, you should define printReport javascript function in end of the page of view associated with the page.

New tab for print is opened with hiding unwanted css and by location.reload(); again the css is originally reloaded.

function printReport(com, grid) {
if (com=='Print')
{
//Removing css to print
$("div.cDrag").remove();
$("div.fbutton").remove();
$("div.pDiv").remove();
$("div.sDiv").remove();

//Defining new css for the print
$("div.mDiv").css({'font-family' : 'Arial,Helvetica,sans-serif', 'font-size': '11px','font-weight': 'bold','margin-bottom':'16px'});
$("div.hDivBox table").css({'border': '1px','font-family':'Arial,Helvetica,sans-serif','font-size': '11px'});
$("div.bDiv table").css({'border-color' : '#00000', 'border': '2px','font-family':'Arial,Helvetica,sans-serif','font-size': '11px'});
var divToPrint= $(".flexigrid");
newWin= window.open(this.href);
newWin.document.write(divToPrint.html());
newWin.print();

//Reloading the flexigrid css

location.reload();
newWin.stop();

}

}

  1. 6 Responses to “Adding Print functionality in Flexigrid Implementation of CodeIgniter”

  2. By Julian Caldwell on Apr 1, 2010 | Reply

    That worked perfectly! Great job.

  3. By admin on Apr 1, 2010 | Reply

    Thanks Julian.

  4. By Sabri on Aug 3, 2010 | Reply

    it dosen’t work for me :( there is no demo plz?

  5. By naresh on Aug 25, 2010 | Reply

    its is working fine in FF and Chrome but showing error in IE.

  6. By admin on Aug 26, 2010 | Reply

    Sorry, I have not tested in IE.

  7. By Chandra on Jun 14, 2012 | Reply

    It is working fine. It Saved my time. Thanks

Post a Comment