Quantcast
Channel: Recent Discussions — DataTables forums
Viewing all 79607 articles
Browse latest View live

Can't access editor node.js docs


Got this error when I added the property scrollY

$
0
0

Got this error when I added the property scrollY.


Could someone help me with this. Used 1.10.18 version

Uncaught TypeError: s.match is not a function
at _fnStringToCss (jquery.dataTables.js:5839)
at i.fn.init._fnScrollDraw (jquery.dataTables.js:5441)
at jquery.dataTables.js:6636
at Function.map (BundledJQuery.min.js:2)
at _fnCallbackFire (jquery.dataTables.js:6635)
at _fnDraw (jquery.dataTables.js:3507)
at _fnReDraw (jquery.dataTables.js:3550)
at _fnInitialise (jquery.dataTables.js:4732)
at loadedInit (jquery.dataTables.js:1294)
at HTMLTableElement.<anonymous> (jquery.dataTables.js:1306)

Node.js datatables editor - Filter select option depending on a certain value

In order to work, why does the AJAX array need to be called 'data" in the "Child rows example"?

$
0
0

I would like to load data into a DataTable using "Child rows" attached to a parent table from a MongoDB data source. MongoDb allows for embedded documents as arrays and/or JSON objects. Some of that data will have the same structure as the sample AJAX used in the "Child rows" example page, with the exception that the name "data" might be "subcontractor" or "manager" instead . The following shows the start of the example AJAX with the name "data":

"data": [
{
"id": "1",
"name": "Tiger Nixon",
"position": "System Architect",
"salary": "$320,800",
"start_date": "2011/04/25",
"office": "Edinburgh",
"extn": "5421"
}

I have no problems using the example JavaScript and AJAX data as long I don't modify the spelling for the name "data" in the source data. When I tried changing "data" to "subcontractor" or "data2" the DataTable wouldn't work. I tried modifying the JavaScript below by changing any reference to "data" to "subcontractor" or "data2" with no results. What do I need to change in the sample JavaScript below to use a different name than "data" in my source JSON?

$(document).ready(function() {
var table = $('#example').DataTable( {
"ajax": "../ajax/data/objects.txt",
"columns": [
{
"className": 'details-control',
"orderable": false,
"data": null,
"defaultContent": ''
},
{ "data": "name" },
{ "data": "position" },
{ "data": "office" },
{ "data": "salary" }
],
"order": [[1, 'asc']]
} );

This is the link to the"Child rows" sample page:

https://datatables.net/examples/api/row_details.html

Bug Fix for columns.adjust()

$
0
0

There is a bug in the columns.adjust() function that can cause columns to extend past the scroll bar (if using scrollY) or past the right edge of the table in some cases. This behavior will happen when using the style table-layout: fixed, allowing table cells to shrink smaller than the text they contain, and setting a column width to 0%. I have created a JS Bin showing the behavior as well as the reason it happens: live.datatables.net/rumomuze/1/edit. The reason being that setting the width of a th to 0% has a different behavior than setting the width to 0px. When the cell is set to 0px it will still be rendered, consuming an amount of space determined by it's padding, margin and border. However, when the cell is set to 0% padding, margin and border are ignored and the column is not rendered at all.

The culprit of this bug is the function _fnCalculateColumnWidths. In this function the datatable DOM instance is cloned and the columns of the cloned table are set to the column property sWidthOrig. If one of the columns sWidthOrig is 0% the cloned table's column is set to 0%, then the original table columns are calculated in px from that. This means that the px width for the other columns (those that aren't 0% width) are calculated with the 0% column not being rendered. When the calculated widths are applied to the original table the 0% column is set to 0px and suddenly has some width that didn't exist when the other columns were calculated, thus the original table is now larger than expected and extends beyond it's right boundary. The fix I am using for this involves calculating a sum of the padding, margin and border for any columns that are set to 0% and removing this space from the size of the cloned table. See the excerpt below:

/**
* Calculate the width of columns for the table
*  @param {object} oSettings dataTables settings object
*  @memberof DataTable#oApi
*/
function _fnCalculateColumnWidths ( oSettings )
{

...

// Apply custom sizing to the cloned header
headerCells = _fnGetUniqueThs(oSettings, tmpTable.find('thead')[0]);

var hiddenWidth= 0;
for (i = 0; i < visibleColumns.length; i++) {
    column = columns[visibleColumns[i]];
    if (/^0*\.?0*%$/.test(column.sWidthOrig)) {
        var header = $(column.nTh);
        hiddenWidth += header.width() === 0 ? header.outerWidth() :
            (header.css("padding-left") + header.css("padding-right") + header.css("margin-left") +
             header.css("margin-right") + header.css("border-left-width") + header.css("border-right-width"));
    }
    headerCells[i].style.width = column.sWidthOrig !== null && column.sWidthOrig !== '' ?
        _fnStringToCss(column.sWidthOrig) :
        '';

...

// When scrolling (X or Y) we want to set the width of the table as 
// appropriate. However, when not scrolling leave the table width as it
// is. This results in slightly different, but I think correct behaviour
if (scrollX && scrollXInner) {
    tmpTable.width(scrollXInner);
}
else if (scrollX) {
    tmpTable.css('width', 'auto');
    tmpTable.removeAttr('width');

    // If there is no width attribute or style, then allow the table to
    // collapse
    if (tmpTable.width() < tableContainer.clientWidth && tableWidthAttr) {
        tmpTable.width(tableContainer.clientWidth);
    }
}
else if (scrollY) {
    tmpTable.width(tableContainer.clientWidth);
}
else if (tableWidthAttr) {
    tmpTable.width(tableWidthAttr);
}

//Remove width that was displaced by columns with 0% width
tmpTable.width(tmpTable.width() - hiddenWidth);

...

}

Scroller extension causes uncaught errors in xhtml files

$
0
0

Using the scroller extension with an xhtml document causes an exception when the table has less than 3 rows. The offending code is on line 1029 of the Scroller 1.5.1 source: https://github.com/DataTables/Scroller/blob/1.5.1/js/dataTables.scroller.js.

This error is caused by invalid xml due to a &nbsp; character reference.

Changing the named entity to the numbered entity (&#160;) has fixed the error in my local setup.

I need example for Infinite Scroll(Load data on scroll)

$
0
0

Hello All,

I need an example for Infinite Scroll.
For example: - At first, there are 20rows in datatable. After I scroll down there should be an ajax call that should get next 20rows and display it.
Can anyone send the example for that

Thanks,
Abhi R

sql server stored procedure

$
0
0

hi,

Is there any way to call sql server stored procedure in editor


While exporting to excel,PDF(more than 10000), always the browser is getting hanged

$
0
0

While exporting to excel,PDF(more than 10000), always the browser is getting hanged and export is not working.

DataTable version is 1.10.18
Button version is 1.3.3

pagination

$
0
0

i table show in pagination render pagination 1 selected . how to make select pagination length 2 select default when page load

Node.js datatables editor - Complex left join not working in node.js

$
0
0

I'm using the node.js datatable editor library. When trying to do a complex left join 'portfolios_isin_mm.isin AND (securities.mic = portfolios_isin_mm.mic)' ... like this:

    let editor = new Editor( db, 'portfolios_isin_mm' )
        .fields(
            new Field( 'portfolios_isin_mm.account_id' ),
            new Field( 'portfolios_isin_mm.user_id' ),
            new Field( 'portfolios_isin_mm.uid_foreign' )
            new Field( 'securities.issuer_name' ),
            new Field( 'portfolios_isin_mm.isin' ),
            new Field( 'portfolios_isin_mm.mic' ),
           )

        .leftJoin( 'portfolios_isin', 'portfolios_isin.id', '=', 'portfolios_isin_mm.uid_foreign' )
        .leftJoin( 'securities', 'securities.isin', '=', 'portfolios_isin_mm.isin AND (securities.mic = portfolios_isin_mm.mic)' );
        //.leftJoin( 'securities', 'securities.isin', '=', 'portfolios_isin_mm.isin' );

I'm getting an error. Debugging the error shows me:

    { Error: ER_PARSE_ERROR: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '.`mic)`' at line 1
        at Query.Sequence._packetToError (/home/myproject/node_modules/mysql/lib/protocol/sequences/Sequence.js:47:14)
        at Query.ErrorPacket (/home/myproject/node_modules/mysql/lib/protocol/sequences/Query.js:77:18)
        at Protocol._parsePacket (/home/myproject/node_modules/mysql/lib/protocol/Protocol.js:278:23)
        at Parser.write (/home/myproject/node_modules/mysql/lib/protocol/Parser.js:76:12)
        at Protocol.write (/home/myproject/node_modules/mysql/lib/protocol/Protocol.js:38:16)
        at Socket.<anonymous> (/home/myproject/node_modules/mysql/lib/Connection.js:91:28)
        at Socket.<anonymous> (/home/myproject/node_modules/mysql/lib/Connection.js:502:10)
        at Socket.emit (events.js:182:13)
        at addChunk (_stream_readable.js:283:12)
        at readableAddChunk (_stream_readable.js:264:11)
        at Socket.Readable.push (_stream_readable.js:219:10)
        at TCP.onStreamRead [as onread] (internal/stream_base_commons.js:94:17)
        --------------------
        at Protocol._enqueue (/home/myproject/node_modules/mysql/lib/protocol/Protocol.js:144:48)
        at Connection.query (/home/myproject/node_modules/mysql/lib/Connection.js:200:25)
        at /home/myproject/node_modules/knex/lib/dialects/mysql/index.js:152:18
        at Promise._execute (/home/myproject/node_modules/bluebird/js/release/debuggability.js:313:9)
        at Promise._resolveFromExecutor (/home/myproject/node_modules/bluebird/js/release/promise.js:483:18)
        at new Promise (/home/myproject/node_modules/bluebird/js/release/promise.js:79:10)
        at Client_MySQL._query (/home/myproject/node_modules/knex/lib/dialects/mysql/index.js:146:12)
        at Client_MySQL.query (/home/myproject/node_modules/knex/lib/client.js:197:17)
        at Runner.<anonymous> (/home/myproject/node_modules/knex/lib/runner.js:146:36)
        at Runner.tryCatcher (/home/myproject/node_modules/bluebird/js/release/util.js:16:23)
        at Runner.query (/home/myproject/node_modules/bluebird/js/release/method.js:15:34)
        at /home/myproject/node_modules/knex/lib/runner.js:65:21
        at tryCatcher (/home/myproject/node_modules/bluebird/js/release/util.js:16:23)
        at /home/myproject/node_modules/bluebird/js/release/using.js:185:26
        at tryCatcher (/home/myproject/node_modules/bluebird/js/release/util.js:16:23)
        at Promise._settlePromiseFromHandler (/home/myproject/node_modules/bluebird/js/release/promise.js:512:31)
      code: 'ER_PARSE_ERROR',
      errno: 1064,
      sqlMessage:
       'You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near \'.`mic)`\' at line 1',
      sqlState: '42000',
      index: 0,
      sql:
       'select count(`portfolios_isin_mm`.`id`) as `cnt` from `portfolios_isin_mm` left join `portfolios_isin` on `portfolios_isin`.`id` = `portfolios_isin_mm`.`uid_foreign` left join `securities` on `securities`.`isin` = `portfolios_isin_mm`.`isin AND (securities`.`mic = portfolios_isin_mm`.`mic)`' }

... with the php libraries it was working just fine:

    ->leftJoin( 'securities', 'securities.isin', '=', 'portfolios_isin_mm.isin AND (securities.mic = portfolios_isin_mm.mic)' ) 

How can I get the complex left join to work in node.js as well?

... I'm using $ node -v ... v10.15.0 and "datatables.net-editor-server": "^1.8.1"

Different editors depending on type?

$
0
0

I know how to create different editors and how to have one button for creating type A with editor A and another for type B, but how can I edit a table entry and get the correct editor?

Simple example:

Name, Type, Amount
Name 1, Type A, 100
Name 2, Type B, 200
Name 3, Type A, 150

That is, if I edit "Name 1" or "Name 3" I get the editor A and if I edit "Name 2" I get editor B.Is there an event for pre-open the editor that I can catch?

Also, the ideal idea would be to be able to switch editor by catching a type combobox change event, like a tabbed editor. If I could do that, I would only need one button and let the combobox be the event driver.

DataTable with attached document

$
0
0

Hello Team,

Is it possible to show document link in DataTable record along with its preview?
If yes, kindly share example.

Integration of deeplink.js into existing table

$
0
0

Hey Guys,
i have a little problem with the integration of the deepLink plugin into my existing table.

This is my original table

$(document).ready(function() {
   var dataTable = $('#mytable').DataTable( {
      "iDisplayLength": 30,
      "pagingType": "full",
      "ajax": "Database.txt",
   } );
} );

Now my table looks like this.

$(document).ready( function () {
   $('#mytable').DataTable( $.fn.dataTable.ext.deepLink( [
      'search.search'
       ] ) 
   );
});

So where do i have to place my settings, for example.

"iDisplayLength": 30,    or
"pagingType": "full",    or
"ajax": "Database.txt",

Does anyone know that ?
I know its a dumb question but i don't get it.
Thx Samu

how to get main value

$
0
0

halo,

im sorry if its basic but im already waste time for this
how i can get main value from this return?
apreciate for the help

thos.target_store.elm.tabled.rows().every( function ( rowIdx, tableLoop, rowLoop ) {
var rendered = this.cells( rowLoop, '' ).render( 'display' );
// console.log(rendered)
} );


ExcelHtml5 Export customize - get background color cell

$
0
0

Good morning, in excel export customize for example I can get the value of the specific cell with the function:

$('is t', this).text();

Is it possible to get the value of the background colour (define with html tag in <td>) of a specific cell?

Thank you if you can help me

Tito

datatable With Large amount of Columns

$
0
0

I am using datatable js for a Table which has 175 column and only 20rows, it is very Slow when applying data table.
i am using inlineedit also , Can any one help me to speed up the data table

How to insert row after specific row?

$
0
0

Hi,
I am using datatables re-reorder plugin. I have some functionality that will insert row after specific row. But i dont find any use full article.

How do I styling 'Showing entries' and 'Pagination'?

$
0
0

I would like to put more margin around both 'Showing 1 to x entries' and 'Pagination.
How do I change the style using CSS?

NB: I already edited both 'Search' input (using .dataTables_filter) and 'Show x entries' (using .dataTables_length).

Thank you in advance.

502 Proxy Error

$
0
0

Hi,

I have problem with datatables + ajax.
It displayed the following error:

DataTables warning: table id=filterTable - Ajax error. For more information about this error, please see http://datatables.net/tn/7

If I inspect it on chrome's network tab. The detail is as follow:

Request URL: http://xxx.xxx.xxx/URL
Request Method: POST
Status Code: 502 Proxy Error

Notes:
We have several other AJAX function using JQUERY but they're running fine.
The proxy error only happened with datatables.

Many thanks and much appreciated for any hint/ helps.

Thank you

Viewing all 79607 articles
Browse latest View live




Latest Images