Suppress Column Ordering with HTML 5 Data Attributes

Home Forums Porto Admin – Responsive HTML5 Template Suppress Column Ordering with HTML 5 Data Attributes

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #10028629
    dsteel
    Participant

    I’m trying to suppress the column ordering icons with HTML data attributes as I have many different tables.

    I am trying
    <table class="table table-bordered table-striped mb-0" id="datatable-default" data-column-defs='[["orderable":false, "targets":0]]' >
    but I can’t seem to get it to work.

    Do you have an example of doing this?

    Thanks

    Davdi


    #10028650
    Support
    Keymaster

    Hello, it must be set in the JS file: examples.datatables.default.js (if you are using advanced tables)

    (function($) {
    
    	'use strict';
    
    	var datatableInit = function() {
    
    		$('#datatable-default').dataTable({
    			ordering:  false,
    			dom: '<"row"<"col-lg-6"l><"col-lg-6"f>><""t>p'
    		});
    
    	};
    
    	$(function() {
    		datatableInit();
    	});
    
    }).apply(this, [jQuery]);

    Let me know if you need further assistance.

    Kind Regards,

    Jonas


    #10028656
    dsteel
    Participant

    I eventually found the answer I was looking for with the following code:

    <thead>
    	<tr>
    		<th>Name</th>
    		<th>Start Date</th>
    		<th>End Date</th>
    		<th>Created By</th>
    		<th>Last Updated</th>
    		<th data-orderable="false">Actions</th>
    	</tr>
    </thead>
    

    Thanks

    David


Viewing 3 posts - 1 through 3 (of 3 total)

This topic is marked as "RESOLVED" and can not rceive new replies.