Jump to content


Bootstrap theme: print and column ordering

print bootstrap order

  • Please log in to reply
No replies to this topic

#1 Vitor Fonseca

Vitor Fonseca

    Newbie

  • Members
  • Pip
  • 3 posts
  • LocationCoimbra, Portugal

Posted 27 October 2020 - 04:41 PM

Hi,

 

 

With bootstrap theme when i print the table the atual column ordering is ignored.

Is this the default behaviour?

 

I edited gcrud.datagrid.js and added this in Datagrid.prototype.listenerPrintButton function

Datagrid.prototype.listenerPrintButton = function () {
		...

			var order_by = $('.column-with-ordering.active:first').data('order-by'),order_direction = '';

			if ($('.column-with-ordering.active:first').hasClass('ordering-desc')) {
				order_direction = 'desc';
			} else if ($('.column-with-ordering.active:first').hasClass('ordering-asc')) {
				order_direction = 'asc';
			}
			
			form_input_html += '<input type="hidden" name = "order_by[]" value="' + order_by + '"/>';
			form_input_html += '<input type="hidden" name = "order_by[]" value="' + order_direction + '"/>';



			form_on_demand = $("<form/>").attr("method", "post").attr("action", print_url).html(form_input_html);
...

and now it's working.

 

Grocery_CRUD.php doesn't need to be changed, because function getStateInfo already has

case 17: //print
                $state_info = (object)array();
                $data = !empty($_POST) ? $_POST : $_GET;

          ...

                if(!empty($data['order_by'][0]))
                {
                    $state_info->order_by = $data['order_by'];
                }
          ...






Also tagged with one or more of these keywords: print, bootstrap, order

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users