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

Possible to use DataTables with ASP.Net Dynamically Created Tables?

$
0
0

Currently I have a standard aspx webform that adds table rows/cells within the Page_Load function. Can DataTables.net be used with dynamically created tables?


how to make table display only selected row?

NET framework not able to run

$
0
0

When I download and run Editor i get an error that says --
DirectoryNotFoundException: Could not find a part of the path 'C:...NET Framework Demo\bin\roslyn\csc.exe

how can i get the sln to run properly?

Reset dataTable data

$
0
0

Hi everyone,

Maybe it's a dumb question, but I didn't find the solution anywhere!

How can I reset my dataTable data after a search query removal?

For example, first I have my query: "something"

table.column(0).search("something").draw();

After removing my query I need to reset the data to the original state.

How can I achieve that?

Thanks,

guilherme

Need to call an event whenever a value in a column changes, after the initial load

$
0
0

I have a faculty scheduler app that has a header column that shows how many classes an instructor has signed up for. When a new class is assigned to an instructor, or a different instructor is assigned to an existing class, I need to update the instructor counts in the header. Have tried this code, but only works the first time thru:

editor.field('event.instructor1_id').input().on('change', function (e, d) {
alert('instr');
if ( d && d.editorSet ) return;
getThisYearCounts(true);
});

Is it possible to fix the buttons, search, paginations, etc. at the header?

$
0
0

I'm trying to figure out if this is possible. When a user scrolls up or down the datatable the following is always visible at the head...

Not every row is clickable - what to do about it?

$
0
0

I am using jquery and bootstrap 4.1. I have generated a table, that is sortable and searchable using the datatables plugin. I want to make each row clickable and I picked up a solution form stackoverflow that makes this work beautifully but only for the first 49 rows of the table whether or not the table has been resorted - (i.e. you click a column heading to resort the table, it still doesnt make the last row clickable)

Here's the code for a typical table row:

 <tr class="clickable-tr" href="/index.cfm?pid=111601&pgm=201851">
          <td>201851</td>
          <td>21/Dec/2018</td>
          <td>Carolina Blue / I Hear Bluegrass Calling Me / Pinecastle</td>
        </tr>

(the link is valid but i'm not sure if that would make a difference at this page)

Here's the CSS for the clickable-tr class:

<style>
    .clickable-tr{
  cursor: pointer;
}
    </style>  

and here's my jquery to enable the datatables plugin and the clickable row:

$(document).ready(function() {
        $('#results').DataTable( {
            "pageLength": 50        
        } );
                $('.clickable-tr').on('click', function(){
                 var myLink = $(this).attr('href');
                 window.open(myLink);
            });  
        
    } );

The only aspect of this whole thing that is connected with row 49 is that is the last row before the pagination takes you to page 2 but I can't see where I've missed something.

Can anyone else?

( Thanks in advance )

Mike Kear Windsor NSW, Australia

asp.net gridview as datatable - Loading data twice

$
0
0

I defined asp.net Gridview as jQuery datatable. Whenever i am loading the page My Datatable displays twice.
Onload - 1 time flickers with Datatable values and after load is complete datatable is getting binded with expected result


AutoComplete AutoFocus Select 1st suggestion Select 1st Dropdown

$
0
0

Hi @allan / @colin

In inline Editor, I managed to use autocomplete. It shows suggestion when keys are entered. My user would like to press on TAB and also click out of the cell, to submit the top suggestion (1st row autocomplete). Even if he entered e.g "A" and sugguestion shows "Apple, Ape, etc", Apple will be autofilled and submitted into database.

I have found autocomplete with autofocus solutions but could not make it work with Datatables.

Something like this for AutoComplete:
https://codepen.io/anon/pen/rVJyRO

http://api.jqueryui.com/autocomplete/#option-autoFocus

What syntax should I use?

Extra padding/height for concatenated data

$
0
0

so am using DataTables to display some data from an SQLite3 database all seems fine except that there is extra padding for all the data that has been concatenated

the problem seem to be a certain inline-style added to the main div during run-time (min-height: 1895px;).
the problem is fixed when i display all the data that has been fetched
Please help if you have an idea how i can solve this
thank you

How do I filter two different values in two columns?

$
0
0

Hi Alan,
before I ask my question, let me say this - I really appreciate datatables and its clean API. Thank you for the effort you put into this js-miracle!

Usually I find all my answers in the forum and stackoverflow, but this one I couldn't solve. I have a table like this:

I would like to count the rows where I have a certain provider in Periode "1", e.g. all "nic.at" where in the same time the 2nd value ='1'. Can you give me a hint as how can I achieve this? I can filter/count one or the other, but not both in the same time.

Thank you a lot!
Christian

How to change a row color from within a aoColumns?

$
0
0

Hello,

I defined my datatable using aoColumns. I have something like this:

[...]{
    "title": "myTitle",
    "mData": "myMData",
    "mRender": function (data, type, val) {
        if(val.myMData > 15){
                //color entire row red
            }
            return val.myMData;
        }
    },[...]

I do not understand how to color the entire row from within that particular column definition.

Thanks!

Column Visibility Drop Down not working

$
0
0

Hi,
I am trying to add a simple colvis button on the table, The button is added to the page but the drop down list if not selectable. Please see the snapshot below:

Get all data from table with cell dropdown filter

$
0
0

Hello people,

i build a table from a DB with 2 dropdown filter (col 5 and col 7), i can export the correct data chosen from dropdown but i can't get the rest of data from table.

I don't want to export col 0 and when i export without col 0, the data was exported to the wrong column in the file.

This is the code that i use:

exportOptions : {
  columns: [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16],  
  format: {     
    body: function( data, row, col, node ) {
      // This is what i want
      if (col == 5) {             
           valor5=minha.tabela
          .cell( {row: row, column: col} )
          .nodes()
          .to$()
          .find(':selected')
          .text();
       } 
      if (col == 7) {             
           valor7=minha.tabela
          .cell( {row: row, column: col} )
          .nodes()
          .to$()
          .find(':selected')
          .text();
       return valor7;
       }
       // This does't work to export the rest of the table.
          outros=minha.tabela
          .rows()
          .data()
          .to$()
          .text();
          return outros;           
       }
    }
  }
}   
],    

I want to put the data to the right column and export all data to the file, please help and i'm sorry for my bad english.

footerCallback Column Sums

$
0
0

Hi there,

I am having a issue with getting the sum total of a column in the DataTable. I have looking through another of questions that have been asked, and have tried the some of the different solutions offered, however I keep getting a > $NaN error.

Below is my code for the DataTable:

$(document).ready(function () {
    $("#staffdatabase").DataTable({

            footerCallback: function ( row, data, start, end, display ) {
            var api = this.api();
            // Remove the formatting to get integer data for summation
            var intVal = function ( i ) {

                return typeof i === 'string' ?
                    i.replace(/[\$,]/g, '')*1 :
                    typeof i === 'number' ?
                        i : 0;

            };

            // Total over all pages

                if (api.column(3).data().length){
                var total = api
                .column( 3 )
                .data()
                .reduce( function (a, b) {
                return intVal(a) + intVal(b);
                } ) }
                else{ total = 0};


            // Total over this page

            if (api.column(3).data().length){
            var pageTotal = api
                .column( 3, { page: 'current'} )
                .data()
                .reduce( function (a, b) {
                    return intVal(a) + intVal(b);
                } ) }
                else{ pageTotal = 0};

            // Update footer
            $( api.column(3).footer() ).html(
                '$'+pageTotal
            );
        },


        // "paging": true,
        //I = Info - SHOWS THE TOTAL NUMBER OF RECORDS IN THE RETURNED DATASET
        //F = Search - SHOWS THE SEARCH FIELD, WHICH ALLOWS FOR QUICK FILTERING
        //L = Menu Length - SHOWS THE MENU LENGTH OPTION, ALLOW TO SET THE NUMBER OF RECORDS DISPLAYED ON THE PAGE
        //P = SHOWS THE PAGE NUMBERS, ALLOWING FOR QUICK NAVIGATION BETWEEN PAGES
        // "searching": true,
        // "scrollX": true,
        "info": true,        
        "ordering": true,
        "autoWidth": true,

    });

});

Call initComplete on table.ajax.reload()

$
0
0

Due to special layout on my webpage I need to get the "recordsTotal" value in a function when I do a table.ajax.reload()
When I do my initial datatable init I have an initCompletefunction where I can get the value in "settings._iRecordsTotal"

But initComplete is not called on ajax.reload. Is there any way to pass the "settings._iRecordsTotal" value when you do a ajax.reload?

I have tried to do a callback function but can 't get i to work: this.$datatable.DataTable().ajax.reload( function(){ this.totalHitsRender(); alert('COME ON') });
If I could only call my totalHItsRender() function like that....

How to sort datable on style background property

$
0
0

Hello,

I would like to sort my datable on the style background . It is possible? How ?
<td class="sorting_1" style="background: red;"></td>
<td class="sorting_1" style="background: white;"></td>

Best regards,
Sébastien

Can I post a cookie on a sort selection?

$
0
0

Hi there everyone!

I'd like the table to remember the user's sort selection when they return to the page with the table. I was wondering if the table doesn't allow for this, what would I modify to handle this?

Any help or insight would be greatly appreciated. Thanks for your time!

Row labels, ie "vertical header"? Is it possible?

$
0
0

I am creating a table that displays a weather forecast for the next 10 days. It is natural that columns represent days, and rows represent weather variables such as temperature.

Therefore, the dates should be put as column headers, but how can I "label" rows? Do I really have to add the labels as pieces of data? I don't like this because:
- the labels are not data and should be logically separate
- labels and data should be visually separate, not share the same background
- I have to use code to handle the empty cells at the top left of the table

I have highlighted the problem areas in the image. I have no idea how to google or search for this. What are my options?

p.s. This library is so amazing and truly inspiring. And the examples, manual and forums are so good. My mind is blown at least once every day I'm using it. For example my mind was just blown because copy-pasting an image into this editor works perfectly.

select2: double initialValue request?

$
0
0

Hello,

I have an editor that's displayed on the page using the onPageDisplay function. Some of the fields are select2 objects using ajax as data source.
When the form is shown, I see 2 initialValue requests for each of the select2 fields ("http://localhost:53686/Registraties/getOptions/TYB?initialValue=true&value=%22%22"). Is this to be expected?
(Sorry, but I can't make this accessible online to debug...)

The form is shown as follows:

        editor
            .buttons({
                label: "Save",
                fn: function () { this.submit(); }
            })
            .create(1, true, {
                focus: null
            });

Example of a select2-field definition:

                {
                    "label": "type behandeling",
                    "name": "TYB",
                    "type": "select2",
                    "opts": {
                        placeholder: '...',
                        ajax: {
                            dataType: "json",
                            url: '/Registraties/getOptions/TYB',
                            data: function (params) {
                                return {
                                    productid: ProductID
                                };
                            },
                            processResults: function (data) {
                                return {
                                    results: data
                                };
                            },
                        }
                    }

                }
Viewing all 81388 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>