Quantcast
Channel: DataTables 1.10 — DataTables forums
Viewing all 2364 articles
Browse latest View live

'preXhr.dt' not fired on first ajax request (after page load)

$
0
0

I am not seeing any console output with the first ajax request (after page load).

The preXhr.dt event doesn't seem to fire until i sort or search.

...on('preXhr.dt', function ( e, settings, data ) {
        console.log('preXhr',data);
 });

What's wrong with Search-field? It jumps to the next line((

filtering and table-id

$
0
0

Filtering my table with this function:

$.fn.dataTable.ext.search.push( function ( settings, searchData, index, rowData, counter ) {
    if(
      (((btnArchief==0) && (searchData[1]=='0')) || ((btnArchief==1) && (searchData[1]=='1'))) &&
      (((btnRelatie==0) && (searchData[2]=="0")) || ((btnRelatie==1) && (searchData[2]=="1")))
    ){
    return true;
    }
    return false;
  };
});

When there are more than 1 table on the page, this filtering will occur on ALL tables. So I need to identify each table. In Version 9 i could identify the table with :

if ( oSettings.nTable.id == 'client05' ) {

so I presume that the table id will be found in settings.
Can you please tell me where I can find the values of "settings" and how to use them?

search regex sub expression error

$
0
0

I am trying to use serverSide=true, search: {regex: true} with sqlalchemy-datatables python on the server side.

I am trying to update sqlalchemy-datatables to support regex. I have successfully added regex on the server side with mysql to handle OR regex on a column (as provided by yadcf select2 multiselect function).

I am also trying to support regex (again with mysql) for the table search, but when I type the OR bar ("|") into the search, the database side raises an exception because there is an empty regex subexpression received.

OperationalError: (OperationalError) (1139, "Got error 'empty (sub)expression' from regexp")

Is there any way to have datatables wait for the user to make the search box contain a valid regex expression before sending it to the server?

(It turns out that sqlalchemy, which is an sql framework for python, only provides mechanisms to support regex with a couple of database engines, and each of these are handled differently. yuck)

column hiding and widths

$
0
0

hi there,

i had written my own version of the old ColVis plugin a few months ago (tragically it was about 2w before you came out with the latest release and a more robust, efficient version of it doh!). I do something like this:

if (toggleColsOn.length > 0) dtApi.columns(toggleColsOn).visible(1, true); redraw = true;
                if (toggleColsOff.length > 0) dtApi.columns(toggleColsOff).visible(0, true); redraw = true;
                if (redraw) dtApi.columns.adjust().draw(false);

I track what the user wants to add/remove from their view and then upon clicking an update function build out the specs to pass on to the columns(myArray).visible() method.

The issue is that my table shrinks when I do this rather than staying full within the modal it's operating in, the original bounds of the <div> it is nested in. What would be the best way to maintain a full width here?

Best,

Right align column with Bootstrap

$
0
0

I noticed that after replacing the default DT style with Bootstrap styling dt-right and dt-nowrap no longer works.

Can't find any information that I should use Bootstrap specific commands for these options to work..

$(document).ready( function () {
  var table = $('#example').DataTable({
    "columnDefs": [
      { className: "dt-right", "targets": [3,5] },
      { className: "dt-nowrap", "targets": [0,1] }
    ]
  });
} );

http://live.datatables.net/rubesuze/1/

ajax.url().load with processing:true won't show "Loading ..." message

$
0
0

Hi
I have added a fonction witch need to clear and load new data from server
I was hoping DataTables to get the "Loading ..." message that I get when refresh or load the table for the first time I get nothing.

first i tried
oTable.clear().draw();
witch display "No data available in table"
and then I do
oTable.ajax.url("../link?parm1=1&parm2=2").load();
"No data available in table" will not change to "Loading ..." until the data is all process

I remove the
oTable.clear().draw();
then screen wont change until the data is all process

debug code is owabuv

Thanks in advance

search only in visible columns

$
0
0

i try this code:

searching: {
columns: ":visible"
},

and its not work.. can you help me?
thx.


search is not workin with data returned by function in ajax

$
0
0

i am using
ajax: function (data, callback, settings) {
var dat = JSON.parse(myTableName.getData(true));
callback(dat)
},

and cant get search o work and i have no errors.

Child Row with colspan="0"

$
0
0

Hi,

Recently after upgrading from 1.10.10 to 1.10.11 we noticed that the child rows are rendering with colspan="0" which makes the child row squish into the first column. This table in particular has 6 visible columns. After some digging it looks like there was change made to _fnVisbleColumns:

1.10.10

function _fnVisbleColumns( oSettings )
{
    return _fnGetColumns( oSettings, 'bVisible' ).length;
}

1.10.11

function _fnVisbleColumns( oSettings )
{
    return $( _pluck( oSettings.aoColumns, 'nTh' ) ).filter(':visible').length;
}

Any thought as to why my visible columns are being filtered out causing this function to return 0?

Thanks in advance,
Kurt

DataTables does not complete

lodash

$
0
0

Dattatables is using lodash . My question is how can i avoid loading loadsh if allready loaded

AJax.Reload returning invalid Json when the Json is valid.

$
0
0

When my datatable is first created i call a function GetJsonData()
var jsonData = GetJsonData();

When i initiate the datatable my data field looks like this.
"data": JSON.parse(jsonData).data

GetJsonData makes an ajax call and returns my json array. This works fine.

When i want to reload the table i have another function called reloadTable

function reloadTable() {
        var table = $('#tblCases').DataTable();
        var jsonData = JSON.parse(GetJsonData()).data;
        table.ajax.reload(jsonData);
    }

you can see this function calls the same function GetJsonData which works on the initial load.
I checked the json that is being returned and json lint says its valid. I can post the json object if needed.
Is there something else i am doing wrong?

Here is an example. It isn't throwing the same errors, but its also not working. If you click on the button to reload the table it throws errors in the console.

http://live.datatables.net/zibohaji/5/edit?html,css,js,output

Set focus on filter input

$
0
0

As discussed at: https://datatables.net/forums/discussion/6401/change-the-word-search-to-filter -- perhaps needs to be updated. Out of the box my filter input's markup looks like

<div id="ordersTable_filter" class="dataTables_filter">
<label>
Search:
<input class="" type="search" placeholder="" aria-controls="ordersTable">
</label>
</div>

I've tried both:

$('#ordersTable_filter input:search').focus(); // tosses error

and:

$('#ordersTable_filter input:text').focus(); // doesn't work

desperately trying to render footer

$
0
0

I cant fnd a way or debug why footer is not rendered. Possible cases, or issues?


TypeScript definations

$
0
0

Is there any update on the availability of officially supported TypeScript definitions for latest versions of DT?

sort column the column width will change

$
0
0

Dear

We encounter one datatables issue, when I set "scrollX": true, the datatable width will change when sort any column, if disable "scrollX", the column width is fixed when sort columns, how can i do, is there any resolve solusion, thanks a lot.

Benny

Mjoin assistance needed (Populating multiple fields with joined table data)

$
0
0

I'm trying to write an Mjoin direct link in my server-side script to provide Name values from a secondary table (Marker.Name) for foreign key values in the primary table (ModuleCourseworkMarks.MarkerAID, ModuleCourseworkMarks.MarkerBID, ModuleCourseworkMarks.MarkerCID).

I've had success doing this with just one foreign key in the past but am having a bit of trouble understanding how the Mjoin syntax works, even with the documentation!

So far I've got this:

$editor = Editor::inst($db, 'ModuleCourseworkMarks', 'ModuleCourseworkMarkID')
...
                Field::inst('ModuleCourseworkMarks.MarkerAID')
                ->options('Markers', 'ID', 'Name')
                ->validator( 'Validate::dbValues' ), 
                
                Field::inst('ModuleCourseworkMarks.MarkerBID')
                ->options('Markers', 'ID', 'Name')
                ->validator( 'Validate::dbValues' ), 
                
                Field::inst('ModuleCourseworkMarks.MarkerCID')
                ->options('Markers', 'ID', 'Name')
                ->validator( 'Validate::dbValues' )

                Field::inst('Markers.Name')
...
                ->leftJoin('Student', 'Student.StudentID', '=', 'ModuleCourseworkMarks.StudentID')
                ->leftJoin('ModuleHistory', 'ModuleHistory.ModuleID', '=', 'ModuleCourseworkMarks.ModuleID')
                ->leftJoin('CourseWorkStatus', 'CourseWorkStatus.id', '=', 'ModuleCourseworkMarks.CourseworkStatusID')
                ->leftJoin('Modules', 'Modules.ModuleID', '=', 'ModuleCourseworkMarks.ModuleID')

                ->join(
                    Mjoin::inst('Markers')
                    ->set( false )
                    ->link('ModuleCourseworkMarks.ModuleCourseworkMarkID', 'Markers.ID')
                    ->fields(
                            Field::inst('ModuleCourseworkMarks.MarkerAID'),
                            Field::inst('ModuleCourseworkMarks.MarkerBID'),
                            Field::inst('ModuleCourseworkMarks.MarkerCID')
                            )
                );
courseworkMarksTable = $('#CourseworkMarksTable').DataTable({
...
"columns": [
    {data: "Markers.Name", editField: "ModuleCourseworkMarks.MarkerAID", className: "editableInline"},
    {data: "Markers.Name", editField: "ModuleCourseworkMarks.MarkerBID", className: "editableInline"},
    {data: "Markers.Name", editField: "ModuleCourseworkMarks.MarkerCID", className: "editableInline"}
    ]

but it's resulting in my receiving the following SQL error being alerted in the browser:

"The multi-part identifier "Markers.Name" could not be bound."

Unfortunately with the site running on our intranet server and tightly integrated with our internal SQL database I'd be unable to replicate the issue using JSFiddle or Datatables Live.

How do you set the placeholder when using chosen js plugin

$
0
0

The default placeholder doesn't seem to work when using chosen js plugin. I tried using data-placeholder but that breaks. When using just placeholder it just keeps coming up with the default selection, "select an option".

        
        fields: [               
                    {
                        "label": "Select A Vendor:",
                        "name": "vendor_select",
                        "type": "chosen",
                        "options": {
                            placeholder: "Select A Vendor"
                        }
                    }

                             ]

SearchDelay for Server-side issue

$
0
0

Is that confirmed issue, or is it in my implementation only that the filter input fires twice. Once immediately on the first letter typed, and second time after the set delay time. I see that in few of my datatables implementations for version 1.10.10

Viewing all 2364 articles
Browse latest View live