hi, when i want to use a feature, as below
e.g;
KTDatatablesExample.init();
Do I have to write the code on every page?
If I'm going to use this feature in many places in my Rails project, how will I do it? Including the file directly isn't enough for it to work?
And these js files are for example: export.js file is defined by the id of a single table.
I have to send the id as below to make it dynamic. I have many pages in my project
Do I send parameters for each page?
Can you explain how to use these elements with js files to provide the proper structure that will apply to each page for my Ruby on Rails project?
table.DataTable().on( 'draw', function() {
tablee = document.querySelector('#c_accounts-datatable');
KTDatatablesExample.init(tablee);
KTMenu.init();
} );
Hi
I mean, you have to customize your datatable js code for reusable. For our example, we create each datatable init for each datatable page. You can see the example js file under the apps folder.
_keenthemes/src/js/custom/apps/ecommerce/customers/listing/listing.js
starterkit/lib/assets/js/scripts.bundle.js
Hi BüÅra,
Sorry for the delay. If you are using the same JS files for several pages, you can make it reusable. The table id can be sent using the HTML data attribute. Eg.
<table class="datatable" data-table->
tablee = document.querySelector($(".datatable"));
should I still draw the table with draw and call the function in my page where I use the feature?
Because as you said, you can only give the class, for example: in the init method in the export.js file, tablee = document.querySelector($('.datatable'));
define it this way doesn't work.
I couldn't really understand the template logic. How can I ensure that only the features I want are used in certain parts of my page?