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

How do I apply customs filters and redraw?

$
0
0

Hello,

I've been working with getting a custom filter working, but I'm completely uncertain how I need to go about doing it.. From my understanding, what I've done will work, but it's certainly not...

Here's a mockup of what I'm working with. Basically, hide all rows that contain a string in column 2 aData[1] http://live.datatables.net/layafebu/1/

Am I missing something here? Hopefully, I'm just being a potato :P

What's the correct way to apply and pop filters off? I need search to work, which from what I can tell, complicates things.


Horizontal Scrolling - Header alignment

$
0
0

Hi,

I am having the header alignment problem and tried the solutions suggested in previous posts, but to no avail. The issue is present both in Chrome and Safari.

Can you please help - the example table is at http://wootrader.com/earnings-coming-soon/

Thanks for the help

Requested unknown parameter '0' for row 0.

$
0
0

I am receiving the following error:

DataTables warning: table id=userlist - Requested unknown parameter '0' for row 0. For more information about this error, please see http://datatables.net/tn/4

<table id="userlist" class="display">
                        <thead>
                            <tr>
                                    <th>id</th>
                                    <th>ip_address</th>
                                    <th>username</th>
                                    <th>password</th>
                                    <th>salt</th>
                                    <th>email</th>
                                    <th>activation_code</th>
                                    <th>forgotten_password_code</th>
                                    <th>forgotten_password_time</th>
                                    <th>remember_code</th>
                                    <th>created_on</th>
                                    <th>last_login</th>
                                    <th>active</th>
                                    <th>first_name</th>
                                    <th>last_name</th>
                                    <th>company</th>
                                    <th>phone</th>
                            </tr>
                        </thead>

                        <tfoot>
                            <tr>
                                                                        <th>id</th>
                                    <th>ip_address</th>
                                    <th>username</th>
                                    <th>password</th>
                                    <th>salt</th>
                                    <th>email</th>
                                    <th>activation_code</th>
                                    <th>forgotten_password_code</th>
                                    <th>forgotten_password_time</th>
                                    <th>remember_code</th>
                                    <th>created_on</th>
                                    <th>last_login</th>
                                    <th>active</th>
                                    <th>first_name</th>
                                    <th>last_name</th>
                                    <th>company</th>
                                    <th>phone</th>
                            </tr>
                        </tfoot>



                        <tbody>
                        </tbody>

                    </table>

Here is MY_User_Table.js

            $(document).ready(function () {
                        // var table = $('#myDataTable').DataTable();
                        var table = $('#userlist').DataTable( {
                            "ajax": "json_get_users",
                        } ); 
            });

Well, using codeigniter here but pretty generic:

public function json_get_users(){
        $this->load->model('MY_Users');
        echo json_encode($this->MY_Users->get_users());
}

And this is the data that is trying to be mapped to the table:

{"aaData":[{"id":"1","ip_address":"21xxxxxxx","username":"administrator","password":"xxxxxxxxxxxxxx","salt":"","email":"admin@admin.com","activation_code":"","forgotten_password_code":null,"forgotten_password_time":null,"remember_code":null,"created_on":"xxxxxxxx","last_login":"xxxxxx","active":"1","first_name":"Admin","last_name":"istrator","company":"ADMIN","phone":"0"}]}

Any guidance much appreciated.

Brgds Richard

load/reload table data on click

$
0
0

i have a datatable with an ajax/json source filtered with a url parameter.

next to my table i have a list of parameters from a php recordset source

what i want to do is, on clicking of the parameter (class) name, pass this value into my ajax source and reload the table

$(document).ready(function(){
 //on click, load the ajax
$(".list-group-item_<?php echo str_replace('.php','',($rspages->getColumnVal("PageName"))); ?>").click(function(){
var table = $('#example').DataTable();
table
 .ajax.url('/ajax/CMS_Content.php?PageName=<?php echo ($rspages->getColumnVal("PageName")); ?>').load();
      });
 });

the 'click' function is running, but the table data is not being reloaded

test page http://www.hutch.forthwebsolutions.com/admin/content/plugins/cmscontent.php

Is there a way to create n columns?

$
0
0

What I would want is to create as many columns as records I have in a table. The idea would be to make some kind of "foreach" inside the declaration. Is there any way?

Thank you

Date Picker in Custom Toolbar

$
0
0

I have successfully installed buttons and a selector on the custom toolbar but have not been able to implement a date picker. I have tried many ways including hints from the forums but there is not one in the custom bar. Any hint would be appreciated. Thanks.

Add child rows visibility status to state save params

$
0
0

Having read around the forum I think I am right in saying that at present it is not possible to add the status of a child row, i.e. open or closed, to the state params?

Currently I use this method to reload the table,

var table = $('#cms_module_system_bookings').DataTable();
table.ajax.reload( null, false );

So my question is can another option be used to reload server side table data which does maintain the status of any open child rows? If not, is there any conceivable way a solution could be developed to maintain the status of the child rows?

Many thanks

How to get the orderable and searchable values for each column when using callbacks and api?

$
0
0

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

i would like to expand on the example above by only adding select boxes for columns marked searchable.

$(document).ready(function() {
    $('#example').DataTable( {
        initComplete: function () {
            this.api().columns().every( function () {
               var column = this;
              
              //this does not work and/or does not exist
               var searchable = column.searchable():

               if (searchable){
                ....do something......
               }
        }
    } );
} );

How to make a custom button behave like built-in buttons?

$
0
0

If a row is selected then my button is enabled and vice versa. I don't want to catch select.dt/deselect.dt and control reload and filter. I want to use behavior of built-in buttons)

The only thing I could come up with: { text: 'My button', extend: 'edit', action: function( e, dt, node, config ) {} } but I'm not sure this is a right way to use ...

call function on cell button click

$
0
0

in my datatable i have 2 rendered button links in each row, each to perform a specific function.

what i want to do is have an on click event for each button, so when each button is clicked, some of the row data is used in each function

i can retrieve the cell data ok

$('#example tbody').on('click', 'td', function () {

    var table = $('#example').DataTable();

    alert( table.cell( this ).data() );
)};

i can retrieve the row data ok

$('#example tbody').on('click', 'tr', function () {

    var table = $('#example').DataTable();

    alert( table.row( this ).data(); );
)};

using the example here http://editor.datatables.net/examples/simple/inTableControls.html

i have a function which fires on the click event of the button link

$('#example').on('click', 'a.ajaxresub', function (e) {
    e.preventDefault();

but can't work out a way to retrieve the row data

var data = $(this).closest('tr'); doesn;t return anything

where clause for DT 1.10

$
0
0

Hello.

I'm upgrading to DT 1.10, and I don't understand how I can make a Where clause for MySQL.

At the end of the serverside_processing file, do I change "simple" to "complex" ? Do I add "complex" to the function the the html file? I've tried this with no success.

Sorry to seem obtuse, but I could not figure this out.

Thanks

update cell on ajax success

$
0
0

Further to my original question on this thread http://datatables.net/forums/discussion/32872/

i am having problems with updating a cell in my table, which should be done only on ajax success.

What I want to do is simply set the cell value to a string value

table.cell( $(this).closest('tr'), 5 ).data( 'Re-subscribed Successfully' )

which works, but not on success

success: function(data) {
                  console.log('Success!', data);
                  var table = $('#example').DataTable();
                  //table.cell( $(this).closest('tr'), 5 ).data( 'Re-subscribed Successfully' )
                  setTimeout( function () {
                      table.draw();
                  }, 1500 );                       
              },

show error to add dataTables.select.min.js extention file to my project

$
0
0

it shows error to add dataTables.select.min.js extention file to my project, the detail error is 'Failed to load resource: the server responded with a status of 404 (Not Found) http://app.softorg.com:81/js/datatables.net.js'

seems it require datatables.net.js, while I can not find this file in my folder, how to fix this issue, thanks

How to apply fnFakeRowspan at multiple columns based on different value at 2nd columns

$
0
0

I have a table #firstTable with 10 rows and 7 column as below How to apply fnFakeRowspan() at 3rd to 7th columns (chp 1 to chp 5) based on different page number at 2nd column (page)

<table id="#firstTable">
  <thead>
    <tr> 
<th>name</th>
<th>page</th>
<th>chp 1 </th>
<th>chp 2 </th>
<th>chp 3 </th>
<th>chp 4 </th>
<th>chp 5 </th>
    </tr>
  </thead>
</table>



Display only special value

$
0
0

Hello, we had create a table. One of the column will store a customer id. We also had create a call to get customer number. If we output like

echo $customernumer

It will display this number. How we can set up a rule, that datatable will only display rows who customernumber ==$customernumer on column customer_id ?


Display a selected row on open?

$
0
0

Do you know if there is a way to pass a Row_Id to DataTables at initializing, so that the table opens on the correct page with that specific row highlighted?

Search table with input fields in cells

$
0
0

Hi,

following this example, how can apply a search filter to columns with input field (Age and Position)?

Thank you, Alex

Scroll to specific row with pagination

$
0
0

I have performance issues in IE using Scroller (deferRender: true, scroller: true) and would like to scroll exactly one row with each mousewheel scroll.

I'm using pagination and have set a function to scroll pages with the mousewheel. However this is too fast. Is there a way to move the table by one row at a time while iDisplayLength = 10? All I need right now is a way to place a specific row at the top of a page.

Something like: myTable.row( rowNumber ).draw( false );

another option could be to: hide offset number of rows and call myTable.page( pageNumber ).draw( false );

for example if I want to scroll to row number 23 with iDisplayLength = 10, I would hide the first two rows and then set myTable.page( 2 ).draw( false );

Best way to update cell in row based on data in another cell?

$
0
0

I'm trying to loop through the rows, updating all the data in cells in a certain column based on the data in the associated cell in another column. Not sure the best way to do that, and am having trouble figuring out how to do it at all. After a couple of hours of struggling with this feel it's time to ask the forum :)

I'm sure there's a better way to do this. I tried starting at the cell level but didn't see how to select the parent to get to the a column data. Probably best done using raw jQuery, but I'm struggling

See http://codepen.io/louking/pen/adaXLY for my non-working example

table = $('#tbl').DataTable({
  columns: [{ name: 'a' }, 
            { name: 'b' }, 
            { name: 'c' }]
})

var andx = table.column('a:name').index();
var bndx = table.column('b:name').index();

table.rows().every ( function () {
  var adata = this.cells( andx ).data();
  this.cells( bndx ).data('xx' + adata);
} );
<table id=tbl>
  <thead>
    <tr>
      <th>col0</th>
      <th>col1</th>
      <th>col2</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>a0</td>
      <td>b0</td>
      <td>c0</td>
    </tr>
     <tr>
      <td>a1</td>
      <td>b1</td>
      <td>c1</td>
    </tr>
  </tbody>
</table>

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