This topic contains 3 replies, has 2 voices, and was last updated by Sean Sean 2 years, 2 months ago.

datatable mRender


  • evilanf
    Participant

    Posts: 1
    Member Reply #6811

    Im using the Metronic datatable wrapper but im not sure how to get the mRender to work as the data object is different to a typical datatable, i have the following but the mRender doesnt seem to work

     

    var TableDatatablesAjax = function() {
    var a = function() {
    $(“.date-picker”).datepicker({
    rtl: App.isRTL(),
    autoclose: !0
    })
    },
    e = function() {

    var fixedHeaderOffset = 0;
    if (App.getViewPort().width < App.getResponsiveBreakpoint(‘md’)) {
    if ($(‘.page-header’).hasClass(‘page-header-fixed-mobile’)) {
    fixedHeaderOffset = $(‘.page-header’).outerHeight(true);
    }
    } else if ($(‘.page-header’).hasClass(‘navbar-fixed-top’)) {
    fixedHeaderOffset = $(‘.page-header’).outerHeight(true);
    }

    var a = new Datatable;
    a.init({
    src: $(“#datatable_ajax”),
    onSuccess: function(a, e) {},
    onError: function(a) {},
    onDataLoad: function(a) {},
    loadingMessage: “Loading…”,
    dataTable: {
    bStateSave: !0,
    lengthMenu: [
    [10, 20, 50, 100, 150, -1],
    [10, 20, 50, 100, 150, “All”]
    ],

    “columns”: [
    { “mData”: “CourseId” },
    { “mData”: “CourseName” },
    { “mData”: “ProgramId” },
    { “mData”: “SubjectId”},
    {
    “mData”: null,
    “bSortable”: false,
    “sTitle”: “Commands”,
    “mRender”: function(data, type, full) {
    return ‘‘ + ‘Edit’ + ‘‘;
    }
    }
    ],

    pageLength: 10,
    // setup rowreorder extension: http://datatables.net/extensions/fixedheader/
    fixedHeader: {
    header: true,
    footer: true,
    headerOffset: fixedHeaderOffset
    },
    “search”: “Search:”,
    ajax: {
    url: “/Course/GetData”
    },
    order: [
    [1, “asc”]
    ]
    }
    }), a.getTableWrapper().on(“click”, “.table-group-action-submit”, function(e) {
    e.preventDefault();
    var t = $(“.table-group-action-input”, a.getTableWrapper());
    “” != t.val() && a.getSelectedRowsCount() > 0 ? (a.setAjaxParam(“customActionType”, “group_action”), a.setAjaxParam(“customActionName”, t.val()), a.setAjaxParam(“id”, a.getSelectedRows()), a.getDataTable().ajax.reload(), a.clearAjaxParams()) : “” == t.val() ? App.alert({
    type: “danger”,
    icon: “warning”,
    message: “Please select an action”,
    container: a.getTableWrapper(),
    place: “prepend”
    }) : 0 === a.getSelectedRowsCount() && App.alert({
    type: “danger”,
    icon: “warning”,
    message: “No record selected”,
    container: a.getTableWrapper(),
    place: “prepend”
    })
    })
    };
    return {
    init: function() {
    a(), e()
    }
    }
    }();
    jQuery(document).ready(function() {
    TableDatatablesAjax.init();
    });

    Sean
    Sean
    Keymaster

    Posts: 4527
    Support Staff Reply #6827

    Hi,

    Sorry, the above code sample won’t be helpful for us in order to investigate the issue. If possible please provide us a test link to your developing site so we can check and debug it online.

    Thanks.


    evilanf
    Participant

    Posts: 1
    Member Reply #6830

    doesn’t matter i ended up ditching the metronic wrapper, it made things a little more difficult so went to standard datatable and applied the metronic styling to that.

    Sean
    Sean
    Keymaster

    Posts: 4527
    Support Staff Reply #6852

    Hi,

    Noted. We will check this further and consider supporting this attribute properly within the Metronic wrapper.

    If you need any further clarifications please let us know.

    Thanks.

You must be logged in to reply to this topic.