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

Does the DataTable run any process when search filter is active?

$
0
0

First of all, DataTable is awesome!!!

I set a table to organize the inventory of the company I work for, and we have a cell (td.editable) to handle the quantity of some product. Then when $(document).ready() I bind a ".on('dblclick',function(){})" to create an input on-the-fly in the style of the phpMyAdmin. Then, when the user hits ENTER or "blur" the input, save the changes.

Everything works fine if the search is null, but if we search for something and dblclick the td.editable, the input is blurred a few moments after it's created.

What could be happens and how can I fix this?


Add 2nd line to row - similar to .child()

$
0
0

Hello,

is it possible to add a 2nd line with information to a row?

Thx for reply!

Table responsive

$
0
0

Hello again,

I'm using two different tables in my view. One is for large and medium devices (PC, iPAD landscape) and one is for small devices. Now I came to Datatables and I want to use all the great features in both tables.

I'm working with MVC4 & Bootstrap.

My fist approach is like my current solution to having 2 tables and initialise both tables with

$('#table1').DataTables({...});

$('#table2').DataTables({...});

I'm showing and hiding the tables with:

<div class="visible-md visible-lg">
  <table id="table1" .....
</div>
<div class="hidden-md hidden-lg">
  <table id="table2" .....
</<div>

My fist (large) table is a table as usual.. but my second table only shows important data well formatted and contains the ability to open a link by clicking on a row (data-href attribute in combination to a java script).

Is there a better way to handle the different tables maybe in one

<

table> to prevent duplicate code? Also I think to call $().DataTables() twice is slower.

Thx a lot and BR

Can i use datatables inside Polymer component?

$
0
0

Hi All,
we are building an web application using angular + Polymer. we have a requirement to show table with add/edit/details/icons etc which are there in datatables.js. We have been using this in many other projects and we liked it more friendly in aspects of developement as well as rich User experience to end users.
My Question is can we use datatables inside polymer and build an component. I found while searching in google that current datatables implementation doesnt support Shadow DOM.
Is it true? if yes then when can we expect ploymer based datatables? if it is false can you please send us details of how we use it.
Or is this scope is out of scope for you guys?
Please let us know as we need this ASAP?

on('postEdit', function( $editor, $json, $data ) Lock wait timeout exceeded; try restarting transact

$
0
0

Hi!
I need to use postEdit function to update another table of my DB as follow:

$data->on('postEdit', function( $editor, $json, $data ) {
  global $conn;
  $ordinato = getOrdinato($data['fromNav_Disponibilita']['idArticolo']);
  if ($ordinato) {
    $idArticoloFisso = $ordinato['idArticoloFisso'];
     $sqlUpdate = "UPDATE righe_disponibilita
      SET idArticolo = '".$idArticoloFisso."'
      WHERE idArticoloFisso = '".$idArticoloFisso."'";
    if ( $resUpdate = $conn->query($sqlUpdate) ) {
        // tutto ok
        //echo $resUpdate;
      } else {
        echo $conn->error;
        }
  }
});

I get this error : Lock wait timeout exceeded; try restarting transaction

I don't know why. I do the same update for create as follow

if ( isset($_POST['action']) && $_POST['action'] === 'create' ) {
    $ordinato = getOrdinato($_POST['data'][0]['fromNav_Disponibilita']['idArticolo']);
  if ($ordinato) {
    $idArticoloFisso = $ordinato['idArticoloFisso'];
    $sqlUpdate = "UPDATE righe_disponibilita
      SET idArticolo = '".$idArticoloFisso."'
      WHERE idArticoloFisso = '".$idArticoloFisso."'";
    if ( $resUpdate = $conn->query($sqlUpdate) ) {
        // tutto ok
        //echo $resUpdate;
      } else {
        echo $conn->error;
        }
  }
}

and all goes well.
Thank you
Pat

How to Resize a column by dragging in Datatable?

$
0
0

Hi
Is it possible to resize the column width by dragging in Datatable?
If possible, I would like to know how to use!

Thanks

How to dynamically enable/disable table ordering?

$
0
0

I find myself in a situation where entries can be added and removed, and there is no point in displaying table sorting when the number of records is just one. Any approach of how to do that?

Keep data in dom when paginating

$
0
0

Hello,

I'm a developer for years, but new with datatables.
I already searched in the internet for the answer to my question, but I didn't find a matching answer, so I'm asking here. :smile:

Is it possible, to let datatables keep the pages of the table in the dom?
Meaning, all of the data is loaded and parsed and pushed to the dom and only the rows, which belong to the current page, would be visible.


Ajax - serverside - Buttons

$
0
0

Hello,

my table is showing tasks for technicians. Every row represents a task.

I'm try using the ajax option. It's working very well if i have only text in the columns. But in my rows I've some Buttons (Show -> Opens a new href with detail information another button opens the workflow modal to send and accept tasks from another user).

My html

<tr class="odd" role="row">
     <td>...</td>
     <td>...</td>
     <td class="sorting_1">...</td>
     <td class="">...</td>
     <td>05.03.2015, 06:07</td>
     <td>...</td>
     <td>...</td>
      <td>-</td>
     <td>
       <button id="workflowBtn" class="btn btn-success workflow btn-padding" data-id="37005"><span class="glyphicon glyphicon-transfer" aria-hidden="true">  </span></button>
     </td>
     <td>
       <a class="btn btn-default" target="_blank" href="http://..."><span class="glyphicon glyphicon-tags" aria-hidden="true"></span></a>
     </td>
     <td>
       <a class="btn btn-default" target="_blank" href="....."><span class="glyphicon glyphicon-book" aria-hidden="true"></span></a>
     </td>
     <td>
       <a class="btn btn-info" href="/Task/ShowTask/37005"><span class="glyphicon glyphicon-search" aria-hidden="true"></span> Details</a>
     </td>

     </tr>
<tr class="odd"><td></td><td colspan="11">....</td></tr>

My controller returns (the last 4 "" are the buttons..):

return Json(new
            {
                draw = param.draw,
                recordsTotal = nonfilteredcount,
                recordsFiltered = filteredCount,
                data = taskList.ToList()
                .Select(r => new[] {
                    r.Task.Text,
                       r.Task.Tid,
                       r.Task.Subject,
                       r.Terminal.Address.ToString(),
                       r.Task.RemindDate + "",
                       r.State,
                       r.Task.ServiceID + "",
                       r.LastTimeRecord + "",
                       "",
                       "",
                       "",
                       ""

                   }
                )
            }, JsonRequestBehavior.AllowGet);

How can I redraw the buttons with Json? Is there maybe a solution?

Thx a lot and BR

Uncaught TypeError: Cannot read property 'mData' of undefined at jquery.dataTables.yadcf.min.js

$
0
0

Yadcf 0.9.1 plugin is working fine for normal data using data table 1.10.13 but when I assigned it to ajax data receiving from web service, received error as-
Uncaught TypeError: Cannot read property 'mData' of undefined at jquery.dataTables.yadcf.min.js:1

I have put all datatable/yadcf js and css into masterTemplate.xhtml,which already contains jquery-1.11.2.min.js I have added jsFiddle without any result as I am fetching data from web service.

https://jsfiddle.net/f0exhc70/

Below image showing that no any column filter contains data.Thanks

Display Only Unused/Available Options in Editor Select

$
0
0

If I have a Field in the Editor wherein I am using something like

 Field::inst( 'VOLUMES.server_id' )
             ->options( Options::inst()
                 ->table( 'SERVERS' )
                 ->value( 'id' )
                 ->label( 'name' )
             )
             ->validator( 'Validate::dbValues' )
     ->leftJoin( 'SERVERS', 'VOLUMES.server_id', '=', 'SERVERS.id' )

And in the javascript, using this in the fields:

              label: "Hostname",
              name: "VOLUMES.server_id",
              type: "select",
              placeholder: "Select the Hostname"

and the values of VOLUMES.server_id (and SERVERS.name for that matter) must be unique per mysql restrictions, is it possible to only display unused options? That way, when selecting from the dropdown, you are only presented with what is available.

Editor still submits data when disabled

$
0
0

I am using the editor inline and disabling the editor if the user doesn't have edit permissions however, although the field is disabled if the user clicks into it then clicks away the form submits. I have turned on onBlur submit but i would have thought this should not happen if the editor is disabled.

 editor = new $.fn.dataTable.Editor({
        ajax: { ... },
        table: "#table",
        idSrc: "Id",
        fields: [...        ],
        formOptions: { inline: { onBlur: "submit", submit: "all" } }
    });

    editor.on("preSubmit", function(e, d, action) {
        $.each(d.data, function(key, vals) { $.extend(d, vals); });
        delete d.data;
        d = JSON.stringify(d);
    });

    $("#table").on("key-focus", function(e, datatable, cell) {
        editor.inline(cell.index());
    });

DataTables and Webpack

$
0
0

Hi there -- I'm using DataTables in Webpack and following the instructions here: https://www.datatables.net/download/npm

The interesting thing about Webpack is that it provides BOTH AMD and CommonJS environments, so when the datatables.net module checks for what to export, it defaults to the AMD module. This breaks everything if in fact you used a CommonJS require() to import the module. What you get is a very mysterious 'cannot set $ of undefined' error.

It took me a while to figure this out but as far as I can tell there are two ways to fix this without modifying the datatables.net code:
(1) Disable AMD entirely in Webpack (see http://stackoverflow.com/questions/29302742/is-there-a-way-to-disable-amdplugin); or
(2) Do NOT immediately invoke datatables.net as instructed at https://www.datatables.net/download/npm. In other words, just require the file without invoking or passing arguments. I'm not exactly sure why this latter solution works.

I suppose an additional solution would be to just embrace the AMD dependency but I have not tried this.

I like DataTables a lot so posting this here to help anyone else out that may run across this issue.

swinc

column searching with range search

Save selection on table redraw


Multiple Editor tables using the same editor template?

$
0
0

The new editor template option is great ... thanks Allan.

I was wondering though ... is it possible to use multiple tables to edit within a single template?

To be more precise ... I have like 5 independent tables and calling the Editor form with 5 separate editor templates. Now it would be great to edit those tables in the same form where each of them is e.g. in a separate tab. Is that possible? Or is there any other way?

Many thanks

Editor Validation - Accept only dbValues available in another column

$
0
0

How exactly can I define that for 'column_04' (text input) only values available in column_02 (of the database column) ... or empty ('') are valid? Like this?

Editor::inst( $db, 'users' )
    ->field(
        Field::inst( 'users.column_01' ),
        Field::inst( 'users.column_02' ),
        Field::inst( 'users.column_03' ),
        Field::inst( 'users.column_04' )
            ->validator( 'Validate::dbValues', array(
                'field' => 'users.column_02'
                'valid' => array(''),
                'message' => "Value does not exist!"
            ) )
    )
    ->process($_POST)
    ->json();

I'm not exactly sure https://editor.datatables.net/manual/php/validation

Using JEditable Edit single cell at a time

$
0
0

How can i edit single cell at a time. and disable remaining

IE 11 text selection in thead.

$
0
0

Hi!

During working with DataTables I noticed that in Internet Explorer 11 I'm unable to select text in thead. I thought it was my fault because I changed headers to individual column search input ( in which I wasn't able to select text and it's annoying) but it appears that DataTables is blocking text selection because even with zero configuration ( https://datatables.net/examples/basic_init/zero_configuration.html ) I can't select text in thead.
Using code found in http://stackoverflow.com/questions/2518421/jquery-find-events-handlers-registered-with-an-object I checked what event are on each th and noticed that there is "selectstart" event bind on them. After deleting this event with jQuery off() function I can select text in my input but I'm afraid it will somehow affect work of DataTables. Is there any reason to be concerned?

EDIT: I'm using DataTables 1.10.12

scrollTo with wrapped columns scrolls to wrong place. How to fix?

$
0
0

I have a serverSide table ('#my_customers_table') with scrollY: "300px" and scroller: true.
Each row has a cell that opens a modal, and after changing some values there I need to redraw the table (showing the changes), and scrolling to the row that was changed.
Scrolling goes to correct place with:
$('#my_customers_table tbody').on( 'click', 'tr', function () {
localStorage.setItem('my_user_table_selectedrow',$(this).index());
});
and
fnDrawCallback: function() {
my_userTable.row(parseInt(localStorage.getItem('my_user_table_selectedrow'))).scrollTo();
});

But there's a problem that some rows have a lot of text that I need to wrap, unless I want table 5000+ px wide, so I added
div.DTS tbody th, div.DTS tbody td {
white-space: normal !important;
}

After that, scrollTo scrolls to (I presume) the place where the row would be if it were not wrapped, i.e in a very wrong place far above the correct one.

Is there a way for scrollTo to take account the height of each row and calculate the correct scrolling poinnt?

Viewing all 81388 articles
Browse latest View live