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

Datatables with asp.net mvc rendering Url.actions/html.actionlinks with route values

$
0
0

Hi,

I am using datatables to render a table with server side asp.net mvc razor views. I am using the render function to display urls for "editing" rows on the table -

 render": function (data, type, row) {
                        return '<a href=\"LinkedAccountsDetails/' + data + '\">Edit</a>';

                       }

How do I use url.actions with routevalues instead of hardcoding the urls like above. I am able to get url.actions without routevalues to work but when i try and concatenate the data variable as a route value it doesn't work.

Thanks


Records shown twice and recently even three times

$
0
0

Hello.

I have a very big problem for a customer. Our online solution runs at several customers and all but a also has no problems. This a customer has its data imported and not entered manually. I think this is an error in the data or the database, but it can not locate.

In DataTables many records after editing some records, now shown twice and recently even three times.

In the database, they are, however, only once. I can detect no error in the database ....

Unfortunately, the debugger is not running well. He tries to save the data and remains available and the browser is timing out. To see what extensions I use here DebugCode the same table with another database: unoqog

Here times eingie Screeshots because the system is a closed system (user name and password are required).

http://www.rappi.de/download/error1.png http://www.rappi.de/download/error2.png

Does anyone have any idea where I could see and what remains to be tested?

Best regards

Thomas

newbie question with MS SQL

$
0
0

I am using MS SQL for the first time and struggle to make it work. I was able to connect to SQL, but I don't know enough to solve error on ssp.class.php, line #408 $stmt = $db->prepare( $sql ); //Fatal error: Call to a member function prepare() on a non-object DataTable live link is below. http://live.datatables.net/gocorusi/1/edit?html,css,js,console,output When I was using MySQL, I never had to edit ssp.class.php file. MS SQL 10.50.2550 on @008 R2 server, PHP 5.4, .dll files installed. I am a newbie, so take it easy on me, first time posting, and not sure if I enter DataTables live correctly.

Thank you, -- Toshi

Header Alignment mismatch with scrollX = true

$
0
0

Hi, I have a column headers misalignment issue, appearing when enabling scrollX. See Image

This is HTML:

<table id="tabellaDati" class="table table-bordered table-hover" >
    <thead>
    <tr>
        <th>Azioni</th>
        <th class="stato">&nbsp;</th>
        <th class="stato">&nbsp;</th>
        <th>Protocollo</th>
        <th>Data Incarico</th>
        <th>Assicurato</th>
        <th>Sinistro</th>
        <th>Evento</th>
        <th>Compagnia</th>
        <th>Data Sinistro</th>
        <th>Data Sopralluogo</th>
        <th>Stato Pratica</th>
        <th>Incaricato</th>
        <th>Data Scadenza</th>
        <th>Casa</th>
        <th>GG</th>
    </tr>
    </thead>
</table>

This is JS:

"lengthMenu": [ [10, 25, 50, 100, -1], [10, 25, 50, 100, "Tutti"] ],
"stateSave": true,
"autoWidth": false,
 "scrollX": "100%",

Is it a known issue or maybe something wrong with my css? Thank you

Using DataTables in Android app

$
0
0

I am trying to implement DataTables functionality in to my Android App. Have you done any work on integrating DataTables 'Search functionality' into an Android app. As mobile apps are more popular customers who use mobiles are more comfortable using an app than browsing. My experience shows out of 25 people most of them are instinctively comfortable with an App.

Any hints on how to use Datatables powerful Search functionailty in a Mobile app would be greatly appreciated.

Is it possible to change button's behavior in a "menu style"?

Multi column search

$
0
0

I have some search fields on the same page as DataTable(). I have built this search function to submit all field content when any field has data changed:

 dt = jQuery('#rowblock').DataTable({
          "processing": true,
          "serverSide": true,
          "searching": false,
          "lengthMenu": [[25, 100, -1], [25, 100, "All"]],
          "sPaginationType": "full_numbers",
          "ajax": 'admin.php?gadmtable=&gadmaction=getgriddata',
          "columnDefs": [{
              "targets": [ 8,11,12,13 ],
                         "render": function ( data, type, full, meta ) {
                             if (type === "display"){
                                 return jQuery("<div />").html(full[meta.col]).text();
                             }else{
                                 return data;
                             }
                        } 
          } ]
      });


  function search(){
      var search = [];
      jQuery('#filterfields :input').each(function() {
          search.push(this.value);
      })
      dt.search( search.join('&'))
      .draw();
  }

However I see no parameter added to the GET request, all search parameters are empty. Any idea what I am missing?

Easy individual column searching (multiple columns)

$
0
0

For anyone looking for a quick solution to filter multiple columns outside of the Datatable structure.

This method simply uses generic form inputs (by class selector), passing in the filtered column index using data-* attributes.

http://jsfiddle.net/kmd1970/jz1zvvr1/

Also If you want to clear the input values when searching globally

$('.filter').on('keyup change', function () {
        //clear global search value
        dtable.search('');
        dtable.column($(this).data('columnIndex')).search(this.value).draw();
});
    
$( ".dataTables_filter input" ).on( 'keyup change',function() {
       //clear all column search values
        dtable.columns().search('');
       //clear all form input values
       $('.filter').val('');
}); 

How to remove "(filtered from NaN total entries)"

$
0
0

Hi,

I have a problem finding documentation. I like the info block at the bottom left that comes up by default, but I need to remove the supplementary text "(filtered from NaN total entries)" I can't find any documentation on how to configure the info block?

Here is by current setup:

jQuery( document).ready( function() {
     var dt = jQuery('#rowblock').DataTable({
         "processing": true,
         "serverSide": true,
         "searching": false,
         "lengthMenu": [[25, 100, -1], [25, 100, "All"]],
         "sPaginationType": "full_numbers",
         "ajax": 'admin.php?gadmtable=&gadmaction=getgriddata',
         "columnDefs": [{

             "targets": [ 8,11,12,13 ],
                         "render": function ( data, type, full, meta ) {
                             if (type === "display"){
                                 return jQuery("<div />").html(full[meta.col]).text();
                             }else{
                                 return data;
                             }
                        } 

         } ]
    });
    dt.ajax.reload();
});

Kind Regards,

Jochen

Uncaught TypeError: Cannot read property 'error' of null

$
0
0

Hello, i get this error in the console: (Uncaught TypeError: Cannot read property 'error' of null), from what i have read in the forums it is due to utf8_encoding, i have tried to force the encoding as other users suggested by modifying this:

        $pdo = @new PDO(
            "mysql:host={$host};{$port}dbname={$db}".self::dsnPostfix( $dsn ),
            //"mysql:host={$host};{$port}dbname={$db}".self::dsnPostfix( $dsn ).";charset=utf8",
            $user,
            $pass,
            array(
                PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION
            )
        );

        $pdo->query('SET CHARACTER SET utf8');
        $pdo->query('SET NAMES utf8');

But it still does not work, do you have any suggestions?

Bootstrap Responsive unnecessary scroll bar

$
0
0

I have a table surrounded by table-responsive class, e.g.

<div class="table-responsive">
<table id="usersTable" class="table table-striped table-bordered table-hover" data-page-length='10'>
....

This produces an unnecessary scroll bar at the bottom of the page.

If I hard code the data (DOM sourced) and remove the DataTable initialization (in this case, by removing the ID), the scroll bar goes away, e.g.:

<table class="table table-striped table-bordered table-hover" data-page-length='10'>
    <thead>
    <tr>
        <th>User Name</th>
        <th>First Name</th>
        <th>Last Name</th>
        <th>Enabled</th>
        <th>Job Title</th>
        <th>Email</th>
        <th>Phone #</th>
        <th>Admin</th>
        <th></th>
    </tr>
    </thead>
            
    <tbody>
        <tr role="row" class="even">
       <td>user name</td>
       <td>First</td>
       <td>Last</td>
       <td>Yes</td>
       <td></td>
       <td>email@emaila</td>
       <td></td>
       <td>No</td>
       <td>Edit</td>
    </tr>
    </tbody>
</table>

When DataTables renders the table, it add:

<div id="usersTable_wrapper" class="dataTables_wrapper form-inline dt-bootstrap no-footer">
    <div class="row">

class="row" adds a left and right margin. If in the debugger, I remove the right margin, the scroll bar goes away, but the page is slightly incorrectly formatted.

Note: I was using Bootstrap 3.2.x and everything worked fine. I recently upgraded to 3.3.5 and that's when things broke.

I am importing Datatables with:

<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/r/bs/dt-1.10.8,fh-3.0.0,kt-2.0.0,r-1.0.7,sc-1.3.0/datatables.min.css"/>
<script type="text/javascript" src="https://cdn.datatables.net/r/bs/dt-1.10.8,fh-3.0.0,kt-2.0.0,r-1.0.7,sc-1.3.0/datatables.min.js"></script>

And Bootstrap with:

<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">

Date format

$
0
0

I have an issue with the date picker showing the wrong date. The date shows correctly (dd-mm-yyyy) in my data table list. I have the format set in the editor to "format": "DD\/MM\/YYYY" ... The date picker appears and highlights the correct day - no problems. But when clicking off it to save value, the date put into the field is 1 day later.

I used the generator on the site to then create the code for me and the opposite happens! I click on the table and the date picker appears but highlights the day before. If i select a date and save, it saves the correct date however.

I copied the datatables editor .js file from the generator code, to overwrite the editor js i downloaded and the issue changed to showing the day prior but saving the correct date!

Please help - no idea where to go from here!

Ajax Error

$
0
0

I am getting an ajax error using datatables. Just the generic error 7. I validated my json and it tested correct. What am i missing.

{
    "data": [
        {
            "CaseName": "FirstTest",
            "ConfigId": "0460115a-3b29-4b85-81e7-dfba079b85cb",
            "PartNumber": "DetermineIfAttributeOnScreen",
            "Image": "?2/24/2016 11:02:27 PM",
            "Status": "",
            "Price": "0",
            "Comments": "",
            "Error": "",
            "LastRun": "2/24/2016 11:02:27 PM"
        }
    ]
}

Column visibility without full width table

$
0
0

I'm sure this is more straightforward than I'm making it. I currently store table states in a database for users to pick and choose from. Those using my app come from different parts of the company and have different preferences when it comes to which subset of data they wish to see. As it stands I've got everything saving and loading just fine except for column width.

My issue is that, as columns are removed via Buttons(ColVis), the full width of the table effectively has a min-width which then causes the columns to expand to fill it. I say "effectively" because it doesn't seem that min-width is the actual cause. I'm using a slightly edited version of ColResize to achieve column resizing. When using ColResize's handles to resize the columns I am able to shrink the columns to the point that the table's width goes below the lower limit I'd mentioned earlier.

I had hoped it would be a simple BootStrap CSS tweak, but if it is I wasn't able to figure that out. I could mess around with different col sizes but that seems like a hacky solution.

Here is a simple example. Just click the button to toggle a column's visibility. I would like for each column to retain it's width and for the table to shrink horizontally.

Un-ordering

$
0
0

hey allan,

is there a way to un do any ordering? i have a DT using server side processing that orders by default on a descending Total Cost column. when the user searches, however, i want their results to be ordered by relevancy—something that I have set up in the backend to happen automatically—not the cost lest their most relevant result be somewhere at the bottom of the list due to the total cost. so, upon search() (or beforehand?) i'd like to simply 'mute' the order. i don't want to disable it entirely since a user may want to subsequently choose a column to order by, but just back out the column that is currently set to order by.

thanks for any info-


How could I not save individual filter in StateSave mode ?

$
0
0

Hello, is there a way so that disable saving of individual filter content when StateSave is set to true ?

just a little more informations : I don't use individual filter in footer but in header like that :

$('#paqView thead tr#filterrow th').each(function () {
    $(this).html('<input class="form-control input-xs input-search" type="text" placeholder="Rechercher" />');
});

Thanks a lot for your answer.

I am looking for a simple table filtering example that demonstrates how to...

$
0
0

I have been searching on this site and external for an example or some code I can implement and all I have found are examples for the legacy version that I have been unable to figure out how to adapt for this version.

Thanks much.

DT_RowID on version 1.10.10

$
0
0

Looking at this: https://datatables.net/manual/server-side and this https://datatables.net/examples/server_side/object_data.html it shows that if you pass DT_RowId as a column that DataTables will automatically assign the id field to the DataTable. I'm passing that in and it's not showing up... Nor if I code hint does it show that "id" is a possible variable to select...

$('#newsFeed tbody').on('click', 'tr', function () {
    var nTr = this.parentNode.parentNode;
    var di1 = this.parentNode.id;
    var di2 = this.id;

DataTable:

    oTable = $('#newsFeed').DataTable({
    "bProcessing": true,
    "bServerSide": true,
    "bSearchable": false,
    "sAjaxSource": 'RSSList',
    "bJQueryUI": true,
    "aoColumns": [
                    //{
                    //    mDataProp: "DT_RowId", "bSortable": false, "bSearchable": false//, "visible": false
                    //},
                    {
                        mDataProp: "RSSName", "bSortable": false, "bSearchable": false
                    }
                 ]
});

JSON

{"aaData":[{"DT_RowId":0,"RSSName":"Most Recent"},{"DT_RowId":1,"RSSName":"My Website"}]}

Cell access on selected row

$
0
0

Updated... It seems the following code works when I remove the "visible".false from the code below. It looks like hiding the column also removed the variable? Also, it would be nice to access the variable by name (RSSID) vs. a fixed cell. Is that possible to do with datatables?

var FeedID = $("td:first", this).text();

I've got the following datatable:

oTable = $('#newsFeed').DataTable({
    "bProcessing": true,
    "bServerSide": true,
    "bSearchable": false,
    "sAjaxSource": 'RSSList',
    "bJQueryUI": true,
    "aoColumns": [
                    {
                        mDataProp: "RSSID", "bSortable": false, "bSearchable": false, "visible": false
                    },
                    {
                        mDataProp: "RSSName", "bSortable": false, "bSearchable": false
                    }
                 ]
});

and I've got the following click function:

$('#newsFeed tbody').on('click', 'tr', function () {
    var nTr = this.parentNode.parentNode;
    if (isOpen == '1')
    {
        oTable.fnClose(nTr);
    }
    else
    {
        /* Open this row */
        var FeedID = oTable.row('.selected',0).data();
        alert('feed ' + FeedID);
        console.log(this);
        $.get("feedList?nFeedID=" + FeedID, function (employees) {
            oTable.fnOpen(nTr, employees, 'details');
        } );
    }
});

What I want to do is access the column 'RSSID' from the selected (clicked) row. How do I do this? I've tried various forms of oTable.row... oTable.cell...

datatable 1.10.11 and jquery 1.11.4

$
0
0

my current installation uses datatable 1.10.4 , jquery 1.11.1 , jquery-ui 1.11.4

the current datatable version 1.10.11 has changed to jquery 1.12.0

is it essential using datatable 1.10.11 with jquery 1.12.0
or can i still use the older jquery 1.11.1 without any changes

Viewing all 2364 articles
Browse latest View live