Okay
  Public Ticket #2187060
Freeze row and column and Freeze row and column
Closed

Comments

  • anup kumar started the conversation

    I want to buy WpDataTables plugin 

    1.   I need freeze option for row and column ( Freeze Top row and 2 or more than 2 column )

    2.  before buy i want to confirm that could you provide current date and time in          database. I need timestamp. When data add or modify in table then every time current date and time should be display intables. 


  •  2,572
    Aleksandar replied

    Hello anup.

    Thank you for your interest in our plugin.

    I am sorry to disappoint you, but unfortunately something like this is not possible with the plugin's built-in features.

    For freezing the header and column, I can share a suggestion from our customer that managed to achieve this

    "I actually created a fixed header and column using translation of x and y (no absolute or fixed position used), very similar to the fixed header provided by weihs5  on this site, and here's one solution, take a look:

    First of all, you gotta set the z-index for each component below:

    jQuery("#table td").css({"z-index": "-1", "position": "relative"});
    jQuery("table tr td:first-child").css({'z-index': '1', 'position': 'relative'});
    jQuery("table th:first-child").css({ 'z-index':'2','position':'relative'});

    Then you gotta add listener on scroll like this:

    jQuery('document').scroll(function () {   scrollBlock();
    });
    

    If your table is set to be scrollable, then you might want to add this in as well:

    jQuery('.wdtscroll').scroll(function () { scrollBlock();
    });
    

    And here's the scrollBlock() part, it is ugly though, but it works for me though. (noted: the numbers work for my theme, if it is not working correctly on yours, then try to adjust the number until it fits.)

    function scrollBlock(){  var table = document.querySelector('table');
    var top = table.getBoundingClientRect().top;
    top = document.body.className.search('admin') > 0 ? top - 32 : top + 3; // this value can change            var left = table.getBoundingClientRect().left;            if(left >= 20){ // before scrolling left (before transforming)                                if(top >= 0){ // before reaching header bar                    jQuery("#table_1 thead th").css("transform", "translateY(0px)");                     translate(jQuery("table th:nth-child(1)"), 0, 0);                     translate(jQuery("table td:nth-child(1)"), 0, 0);                                    } else{ // after reaching header bar                     jQuery("#table_1 thead th").css("transform", "translateY( " + (-top) + "px)");                     translate(jQuery("table th:nth-child(1)"), 0, -top);                     translate(jQuery("table td:nth-child(1)"), 0, 0);                 }            } else { // after scrolling left                                if(top >= 0){                    jQuery("#table_1 thead th").css("transform", "translateY(0px)");                    translate(jQuery("table th:nth-child(1)"), -left + 46, 0);                    translate(jQuery("table td:nth-child(1)"), -left + 46, 0);                                    } else{                     jQuery("#table_1 thead th").css("transform", "translateY( " + (-top) + "px)");                     translate(jQuery("table th:nth-child(1)"), -left + 46, -top);                     translate(jQuery("table td:nth-child(1)"), -left + 46, 0);                     }                }            }
    function translate(element, x, y) {
    var translation = "translate(" + x + "px," + y + "px)"
    element.css({      "transform": translation,       "-ms-transform": translation,          "-webkit-transform": translation,     "-o-transform": translation,      "-moz-transform": translation,   });
    }
    

    It is kind of messy, you definitely can't copy and paste and expect it to work for you. You need to spend some time to figure it out. Hope this helps everyone!"

    So hopefully this can help you out.

    And when it comes to a timestamp column, there's a workaround.

    For example, I created a simple manual table:

    9084543304.png

    wdt_ID column is being automatically generated, and is usually hidden, but I've displayed it here for explanation purposes.

    When I created a table, and added the first row, I could then modify it. So, in order to set the Datetime column to be auto-populated, I had to open the table in the database. It is being stored as wp_wpdatatable_6, and you can see its database name in Editing tab in the settings above the table:

    8975736742.png

    Then, in PHPMyAdmin, I opened the table, and ran the following query:

    ALTER TABLE `wp_wpdatatable_6` CHANGE COLUMN `datetime` `datetime` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP;
    
    7657773118.png

    After that, again in the Editing tab, above the table, I changed the "ID column for editing" from "wdt_ID" to "datetime" (as you can see in the screenshot above). Then I disabled editing for "wdt_ID" in the column settings:

    4393899573.png

    datetime column, being the "ID column for editing" automatically cannot be edited, but is automatically filled.

    You can also choose to hide it from view if you'd like.

    I hope this helps.

    Best regards.


    Kind Regards, 

    Aleksandar Vuković
    [email protected]

    Rate my support

    wpDataTables: FAQ | Facebook | Twitter | InstagramFront-end and back-end demo | Docs

    Amelia: FAQ | Facebook | Twitter | InstagramAmelia demo sites | Docs | Discord Community

    You can try wpDataTables add-ons before purchasing on these sandbox sites:

    Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables | Master-Detail Tables

  •   anup kumar replied privately
  •  2,572
    Aleksandar replied

    Hello again anup.

    1. I am sorry to disappoint you, but unfortunately something like this is not possible with the plugin's built-in features. Maybe it could be done with some customization or with a custom Query, but this doesn't fall under included support of the plugin.

    2. I'm sorry, but I don't quite understand what the question here is?

    3. I've already replied to this, but in case you missed it, here it is:

    I am sorry to disappoint you, but unfortunately something like this is not possible with the plugin's built-in features.

    For freezing the header and column, I can share a suggestion from our customer that managed to achieve this

    "I actually created a fixed header and column using translation of x and y (no absolute or fixed position used), very similar to the fixed header provided by weihs5  on this site, and here's one solution, take a look:

    First of all, you gotta set the z-index for each component below:

    jQuery("#table td").css({"z-index": "-1", "position": "relative"});
    jQuery("table tr td:first-child").css({'z-index': '1', 'position': 'relative'});
    jQuery("table th:first-child").css({ 'z-index':'2','position':'relative'});

    Then you gotta add listener on scroll like this:

    jQuery('document').scroll(function () {
       scrollBlock();
    });
    

    If your table is set to be scrollable, then you might want to add this in as well:

    jQuery('.wdtscroll').scroll(function () {
     scrollBlock();
    });
    

    And here's the scrollBlock() part, it is ugly though, but it works for me though. (noted: the numbers work for my theme, if it is not working correctly on yours, then try to adjust the number until it fits.)

    function scrollBlock(){  var table = document.querySelector('table');
    var top = table.getBoundingClientRect().top;
    top = document.body.className.search('admin') > 0 ? top - 32 : top + 3; // this value can change            var left = table.getBoundingClientRect().left;            if(left >= 20){ // before scrolling left (before transforming)                                if(top >= 0){ // before reaching header bar                    jQuery("#table_1 thead th").css("transform", "translateY(0px)");                     translate(jQuery("table th:nth-child(1)"), 0, 0);                     translate(jQuery("table td:nth-child(1)"), 0, 0);                                    } else{ // after reaching header bar                     jQuery("#table_1 thead th").css("transform", "translateY( " + (-top) + "px)");                     translate(jQuery("table th:nth-child(1)"), 0, -top);                     translate(jQuery("table td:nth-child(1)"), 0, 0);                 }            } else { // after scrolling left                                if(top >= 0){                    jQuery("#table_1 thead th").css("transform", "translateY(0px)");                    translate(jQuery("table th:nth-child(1)"), -left + 46, 0);                    translate(jQuery("table td:nth-child(1)"), -left + 46, 0);                                    } else{                     jQuery("#table_1 thead th").css("transform", "translateY( " + (-top) + "px)");                     translate(jQuery("table th:nth-child(1)"), -left + 46, -top);                     translate(jQuery("table td:nth-child(1)"), -left + 46, 0);                     }                }            }
    function translate(element, x, y) {
    var translation = "translate(" + x + "px," + y + "px)"
    element.css({
          "transform": translation,
           "-ms-transform": translation,
              "-webkit-transform": translation,
         "-o-transform": translation,
          "-moz-transform": translation,   });
    }
    

    It is kind of messy, you definitely can't copy and paste and expect it to work for you. You need to spend some time to figure it out. Hope this helps everyone!"

    Please note that none of this is included in the built-in features of the plugin, and all are done through customization. Included support covers help with bugs and general inquiries for the plugin features, but not writing custom code. 

    We have a paid customization service, but unfortunately our developers are very busy at the moment, working on some priority tasks and fixing bugs and issues with our plugins, so they won't be having the time for custom work in near future.

    But we can recommend these services for customization:

    https://codeable.io/?ref=l1TW1

    https://wpkraken.io/?tms-plugins

    If you do purchase the plugin, you will probably have to reach out to them to have these features developed.

    Best regards.

    Kind Regards, 

    Aleksandar Vuković
    [email protected]

    Rate my support

    wpDataTables: FAQ | Facebook | Twitter | InstagramFront-end and back-end demo | Docs

    Amelia: FAQ | Facebook | Twitter | InstagramAmelia demo sites | Docs | Discord Community

    You can try wpDataTables add-ons before purchasing on these sandbox sites:

    Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables | Master-Detail Tables

  • anup kumar replied

    Thank you for replying, 

    Can you please suggest me where i can put these code?

    which is provided by you.

    and I need only column freezing.

    Please provide me column freezing code and where can i put those codes.

    Please help me

  •  472
    Isidora replied

    Hi anup,

    Sorry for late response. 

    We are located in Serbia and our working time is from 10:00 to 17:00 CET. business days.

    Aleksandar is on vacation and I will answer you.

    Like Aleksandar already explain you and share some workaround for specific case from one of our customers for fixed header and column and that is not that you can just copy and paste and expect to work for you as well. You need to adopt for your case. That is the JavaScript that need to be on the same page as your table to make it possible.

    As Aleksandar already explain you :

    Please note that none of this is included in the built-in features of the plugin, and all are done through customization. Included support covers help with bugs and general inquiries for the plugin features, but not writing custom code. 

    Because our dev team is too busy at the moment, my suggestion is to contact services that you can find in Aleksandar previous post.

    Thank you for understanding.

    Best regards.

    Kind Regards, 

    Isidora Markovic

    wpDataTables: FAQFacebookTwitterFront-end and back-end demoDocs

    Amelia: FAQFacebookTwitter |  Amelia demo sites | Docs

    You can try our wpDataTables add-ons before purchase on these sandbox sites:

    Powerful FiltersGravity Forms Integration for wpDataTablesFormidable Forms Integration for wpDataTables