KoolReport's Forum

Official Support Area, Q&As, Discussions, Suggestions and Bug reports.
Forum's Guidelines

DataTables::create() "options" do not appear to be working #3054

Open Jon Juracich opened this topic on on May 22, 2023 - 4 comments

Jon Juracich commented on May 22, 2023

We are upgrading a package written with CodeIgniter 2 to a version written in CI 3. The code that is causing the issue is completely custom, and not supplied / supported by the vendor. So, we're bringing it directly over from the earlier software to the current version.

When running on the "old" system, the "options" keyword creates buttons and paging options. On the "new" system, it does not.

Here is the code in question:

DataTables::create(array(

            "dataSource"=> $table_data ,
	"fastRender" => true,
	"plugins" => ["Buttons"],
	"showFooter"=>true,
	"columns"=>$table_columns,
	"searchMode" => "smart",
	"options" =>array(  "dom" => '<"bottom"l<"clear">>,"Bfrtip"',
			"buttons" =>
					[		[
							'extend'=>'csvHtml5',
							'text'=>'<i class="fa-light fa-file-csv"></i> CSV',
							'titleAttr'=>'csv'
					],

							[
									'extend'=>'excelHtml5',
									'text'=>'<i class="fa-light fa-file-excel"></i>Excel',
									'titleAttr'=>'Excel'
							],
							[
									'extend'=>'copyHtml5',
									'text'=>'<i class="fa-light fa-copy"></i> Copy',
									'titleAttr'=>'Copy'
							],
							[
									'extend'=>'print',
									'text'=>'<i class="fa-light fa-print"></i> Print',
									'titleAttr'=>'Print'
							],
					],
			"paging" => true,
			"pagingType"=> "full_numbers",
			"searching"=>true,

			"order"=>array(
					array(1,"desc")
			),
	),

));

Thanks!

Sebastian Morales commented on May 24, 2023

Pls open Dev tool (F12) in your page, then reload the page and see if there's any error (red lines) in the console.

Jon Juracich commented on May 24, 2023

Thank you for the reply, Sebastian.

Here is the console output for the page:

This page uses the non standard property “zoom”. Consider using calc() in the relevant property values, or using “transform” along with “transform-origin: 0 0”. purchase_orders

Using //@ to indicate sourceMappingURL pragmas is deprecated. Use //# instead jquery.min.js:2:21

Layout was forced before the page was fully loaded. If stylesheets are not yet loaded this may cause a flash of unstyled content. jquery.min.js:6:26533

Cookie “phppos” does not have a proper “SameSite” attribute value. Soon, cookies without the “SameSite” attribute or with an invalid value will be treated as “Lax”. This means that the cookie will no longer be sent in third-party contexts. If your application depends on this cookie being available in such contexts, please add the “SameSite=None“ attribute to it. To know more about the “SameSite“ attribute, read https://developer.mozilla.org/docs/Web/HTTP/Headers/Set-Cookie/SameSite purchase_orders

Source map error: Error: request failed with status 404 Resource URL: http://mods19.erp.dfwh.com/js/jquery.min.js Source Map URL: jquery-1.10.2.min.map

Sebastian Morales commented on May 25, 2023

Pls open tab Network in Dev tools and see how many jQuery.min.js or jQuery.js files are loaded? If there're more than one remove all but the KoolReport one. If there's only one, open its content and make sure its version is at least 3.x.

Jon Juracich commented on May 25, 2023

Sebastian, we have a TON of jquery files being loaded. According to $.fn.jquery, the non-working system is using version 1.11.1. Interestingly, the working system is using 1.10.2. I'll probably try upgrading jquery to see what happens on my local machine. Again, thank you for replying!

Build Your Excellent Data Report

Let KoolReport help you to make great reports. It's free & open-source released under MIT license.

Download KoolReport View demo
help needed

CodeIgniter