Are you the publisher? Claim or contact us about this channel


Embed this content in your HTML

Search

Report adult content:

click to rate:

Account: (login)

More Channels


Showcase


Channel Catalog


Channel Description:

Recent Discussions — DataTables forums

older | 1 | .... | 2284 | 2285 | (Page 2286) | 2287 | 2288 | .... | 2326 | newer

    0 0

    There is a bug in the ColReorder Extension causing misalignment of the column insert points to their actual location. This causes the pointer (the indicator that shows where a column will be dropped) not to line up with the border between columns when a large number of columns are displayed (from my testing somewhere around 7+). I've created a JS Bin to show the behavior. In the example, the top table is displaying current behavior, the bottom table displays the behavior with my suggested fix. When you reorder the columns to the far right you will notice that the pointer does not line up properly with the column borders in the top table. You can see in the javascript that I have overriden the _fnRegions functions for the second table. Note the line:

    //total += $(aoColumns[i].nTh).outerWidth();
    total = $(aoColumns[i].nTh).offset().left;
    

    outerWidth() is not accurate enough here as the width is rounded down (or up in some cases) for every column, losing precision on every iteration until it is off by full pixels. Getting the left offset will provide a more accurate location for the pointer.


    0 0

    Hi,

    I'm using responsive, colvis and colreorder with statesave
    I'm having the following issue

    See the jfiddle to reproduce
    http://jsfiddle.net/lenamtl/v341qbyx/23/

    I have a lot of columns some are hidden by responsive

    Hide some column with colvis till you see one of the column which is hidden by the responsive
    based on the jsfiddle example let hide all except Role and Register date
    -the result is ok in table and in statesave value

    Let move one column register date in front of Role
    so now we have Role, Register date and Tool

    Now let show all hidden columns using colvis
    the result is ok in table and in statesave value
    so now we have Role, register date ( all other columns) and tool

    refresh the page
    the result in table is NOT OK the colunm Register date is now Hidden (have display none class)
    the result is ok in statesave value (the column is visisble in statesave)
    So this mean this column keep the class display none class from responsive
    but the column have change position so the column display none class should be removed and it is not

    I need an urgent quick fix for this.
    Thanks


    0 0

    First, thanks for DataTables; it's an impressive module.

    Using DataTables' Responsive extension, is it possible to add the data representing hidden columns to a pre-existing child row (not overwriting existing content) instead of creating a new child row? That would also include not placing a new user control. The options described in the extension's documentation do not suggest a solution to me.

    Alternatively, I would also write my own handler functions, if I knew which hooks to use.


    0 0

        var table = $('#PositionRankings').DataTable({         
            "paging": true,
            "pageLength":10,
            "pagingType":"simple",  
            "info": false,
            "scrollX": true,
            "scrollCollapse": true,
            "order": [7, 'desc' ],
            dom: 'Bfrtip',
            buttons: [ ]
        });  
    

    I have that table on this page: https://www.topflightfantasysports.com/fanduel-nba-optimizer/

    Its using Pagination. The first column of this table is a checkbox, when the user hits the "Create Lineups" button at the bottom, I need to cycle through the table and find all the checkboxes that are checked yes. However my code only finds the ones that are currently showing and not the paginated rows that are hidden currently.

            $checkboxLock = $('.Locked:checkbox:checked');
            var LockArray = '';
            LockArray = $.map($checkboxLock, function(el){            
                if(el.checked) { 
                    return '"' + el.id + '"'; 
                } else {                 
                };
            });           
            //alert(LockArray);
            console.log(LockArray);  
    

    That's my current code to find them. If I view page source all the records are showing in the actual source. So I just need to know how to find the value of all the rows, not just the ones showing for my first column.


    0 0

    I have data like this (simplified):

        [
            {
                "songid":       "56",
                "title":   "Song A",
                "tagged":     "0",
                "audio":     "1",
                "chords":     "1"
            },
            {
                "songid":       "7",
                "title":   "Song B",
                "tagged":     "1",
                "audio":     "0",
                "chords":     "1"
            }
            {
                "songid":       "24",
                "title":   "Song C",
                "tagged":     "0",
                "audio":     "0",
                "chords":     "0"
            }
        ]
    

    I want to do two things when the table is set up. The first is to render the title cell with stuff that comes from three other pieces of data in the row: songid, audio, and chords. The song title would become a hyperlink that uses the songid, and that would be followed by an icon if audio=1 and/or another icon if chords=1. For example, the desired result for the first row in the above example is:

    <a href="song.php?sid=56">Song A</a>&nbsp;<img src="graphics/audio.gif">&nbsp;<img src="graphics/guitar.gif">
    

    The docs give the following example of using a function for columns.render:

        render: function ( data, type, row, meta ) {
          return '<a href="'+data+'">Download</a>';
        }
    

    But I don't know how to reference a different column. Just from the parameter names, it looks like row might somehow hold the data for the whole row or something, but I don't know how to use it and can't find any documentation about it. Just for the simple hyperlink part, I tried:

        render: function ( data, type, row, meta ) {
          return '<a href="song.php?sid='+row.songid+'">'+data+'</a>';
        }
    

    But it returned "undefined" for row.songid.

    The second thing I want to do is pre-select the rows that have tagged=1. Based on clues I picked up from various sources in the docs, I thought this would do it:

        table.rows( function(idx, data, node) { return data.tagged == 1; }).select();
    

    But it doesn't appear to do anything - no rows get selected.

    Any clues on either of these?


    0 0

    hi everybody,
    I've read one or two posts here making questions about the possibility of entire row validation when a field changes. In my case, what i need is to validate each field onPreSubmit and focus on the input that has the error, making it editable. I've changed the method so that if the changed value is valid, I close the editor instance and open a new one for the invalid field(next field to be validated) , returning false.
    But it seems to be useless, it makes a previous submit and then makes the invalid field editable with the error behind.
    is there any (better) way to achieve this?

    Thanks in advance, guys!


    0 0

    have a set of "columns": [
    { "data": "Status" },
    { "data": "Location" },
    { "data": "Entity" },
    { "data": "Date" },
    ],

    have set a data-order tag for the Date field

                  <TD align="center" class="StdText" data-order=<!$MG_ORDER_DATE_SORT>><!$MG_DATE></TD>
    

    viewing the source shows the tag value in YYYYMMDD format

                  <TD align="center" class="StdText" data-order=20120113>01/13/2012</TD>
    

    sadly the sort does not work. it sorts as per the displayed date which is MM/DD/YYYY

    When I delete the "columns": section from the html the sort works, but then, I need that definition for the purpose of export..

    what do I need to do, to make the sort work?

    I have other reports with data-order tags for date fields and the sorting works fine, but those reports do not have the orthogonal data definition.

    Thanks

    Idris


    0 0

    Hi :)
    I have a select input just in the header of one column with differents values, and in my rows, thoses values appear like icon-svg, not text

    To work with this select, "searchable" must have to true in columndefs
    my problem, I would like exclude this column in the input search,
    I've tried with : this.api().table().columns( [2, 3] ).search( val ).draw();
    My column with select is the 1st
    Val is the value of the input which I catch.

    But there is no entry

    Thanks


    0 0

    Hey,

    i would like to completely hide this text from showing it below table, is that possible with some easy line?

    ty


    0 0

    Row always returns to its original location. Tried with Safari 12.0.2 and Chrome 71.0.3578.80.

    I tried with my own code (used to work), and with the a couple of examples (including one on your site):

    1) http://jsfiddle.net/h4wrmfx3/764/

    2) https://editor.datatables.net/examples/extensions/rowReorder.html

    This would seem to be a common issue, but didn't see any other recent questions in the Forum about the issue.


    0 0

    Essays are one the most important parts of a student's life and they hold utmost importance in the success of a student's academic achievements.buy essays It takes a lot of time to think and write. So online essay writing service is best for those people who are busy.


    0 0

    I have a lot of data that needs to be put in the datatable. The code was written long back that rewriting the code will be a huge task for me to add server side pagination.
    So I had applied a filter 'Sub Brand' so that I can reduce the count of data coming in the UI.

    The count of data reduced significantly by the ratio, but still there were 2088 data that needs to be populated in the datatable.
    However, 2088 was still taking a time of almost 8-10 seconds.

    I tried improving the SQL query so that I can just fetch whatever data I need for the particular page. Even though the query executed faster than before, the time taken for the UI to load is still the same, without any significant change.

    Could you suggest me a solution for this, excluding server side pagination for now?
    If there are no other solutions, that's the one I will probably have to go ahead with, but considering the time and testing it requires, I'm not really sure if my colleagues would suggest that way.

    Thanks!


    0 0

    I have a table with a complex header (huge amount of columns). I am using the colvis button to show a list of the columns in the table and to toggle column visibility. I would to add to that list a scroll bar. I know that you can add columns to the list but I would like to add a scroll bar to facilitate to search the desired column.

    I would like something like that...

    It would be possible?

    Thank you in advanced.


    0 0

    (20w 5V 4A 3-Port USB Charging Station) Multi-Port USB Charger Desktop Hub for iPhone 6s / 6 / 6 Plus, iPad Air 2 / mini 3, Galaxy S6 / Edge / Plus, Note 5 and More (Black)
    with total electric current display url:http://www.yunmeidg.com


    0 0

    I'm getting a "Cannot retrieve inserted id - no primary key was found." error when I try to create a new record using editor.
    I'm using dotnet core 2.1 with razor page model.

    Here's my Javascript


    (function($){ $(document).ready(function() { var editor = new $.fn.dataTable.Editor({ ajax: { url: '/EmployeePortal/BursaryBundleHandler', //headers: function (d) { d.RequestVerificationToken = $('input:hidden[name="__RequestVerificationToken"]').val();} beforeSend: function (xhr) { xhr.setRequestHeader("RequestVerificationToken", $('input:hidden[name="__RequestVerificationToken"]').val()); } }, table: '#BursaryBundles', fields: [ { "label": "NumberLearners:", "name": "NumberLearners" }, { "label": "TotalCost:", "name": "TotalCost" }, { "label": "PaymentReference:", "name": "PaymentReference" } ], idSrc: "BursaryBundleID" } ); var table = $('#BursaryBundles').DataTable( { dom: 'Bfrtip', ajax: { url: '/EmployeePortal/BursaryBundleHandler', beforeSend: function (xhr) { xhr.setRequestHeader("RequestVerificationToken", $('input:hidden[name="__RequestVerificationToken"]').val()); } }, columns: [ { "data": "NumberLearners" }, { "data": "TotalCost" }, { "data": "PaymentReference" } ], select: true, lengthChange: false, buttons: [ { extend: 'create', editor: editor }, { extend: 'edit', editor: editor }, { extend: 'remove', editor: editor } ] } ); } ); }(jQuery));

    Here's the C# Razor page model:


    public class BursaryBundleHandlerModel : PageModel { [HttpPost] [ValidateAntiForgeryToken] public JsonResult OnPost([FromBody]DtRequest dTBinder) { var request = HttpContext.Request; using (var db = new Database("sqlserver", "Server = (localdb)\\mssqllocaldb; Database = Edupay; Trusted_Connection = True; MultipleActiveResultSets = true")) { var response = new Editor(db, "dbo.BursaryBundles", "BursaryBundleID") .Model<BursaryBundleVM>() .Process(request) .Data(); return new JsonResult(response); } } [HttpGet] public JsonResult OnGet([FromBody]DtRequest dTBinder) { var request = HttpContext.Request; using (var db = new Database("sqlserver", "Server = (localdb)\\mssqllocaldb; Database = Edupay; Trusted_Connection = True; MultipleActiveResultSets = true")) { var response = new Editor(db, "dbo.BursaryBundles", "BursaryBundleID") .Model<BursaryBundleVM>() .Process(request) .Data(); return new JsonResult(response); } } }

    Here's the model:


    public class BursaryBundleVM { [JsonProperty("NumberLearners")] public int NumberLearners { get; set; } [JsonProperty("TotalCost")] public float TotalCost { get; set; } [JsonProperty("PaymentReference")] public string PaymentReference { get; set; } }

    And here's the sql server table


    CREATE TABLE [dbo].[BursaryBundles] ( [BursaryBundleID] INT IDENTITY (1, 1) NOT NULL, [NumberLearners] INT NOT NULL, [SchoolID] INT NULL, [TotalCost] REAL NOT NULL, [PaymentReference] NVARCHAR (MAX) NULL, [EmployeeID] INT NULL );

    Any ideas what I'm doing wrong? Many thanks in advance for any help.


    0 0

    I'm following the example in https://editor.datatables.net/manual/net/mvc using dotnet core 2.1 but in Visual Studio the "return JsonResult(response);" gives the error "Non-invocable member JsonResult cannot be used like a method". Any ideas what I'm doing wrong?


    0 0

    Hello,
    I had downloaded the datatables and it is working fine, however, when I try to use the export buttons,

    • the table I had styled it to rtl, but when it is exported, it is being viewed as ltr,
    • It is not recognizing arabic characters in PDF, what is the issue?

    • Regards,

    0 0

    Dear Sir,
    I have used your blog.
    https://datatables.net/forums/discussion/29550/server-side-processing-with-spring-mvc
    Please guide me that how we can apply where condition. because I need to filter the records based on logged in user. also, please guide that is there any way to write our own repository function such as findAllById(input) etc...

    Thank You


    0 0

    Dear Allan!
    I found new problem In fixed row.
    I turn off redraw, and the editor can change edited row data, but not change fixed column data.
    The data is wrote in fixed col, but not refresh.
    If I move with arrow on the fixed column (selected) or click mouse on fixed column (selected), the fixed column refreshing, and see good data.
    (my test table fixed column is second (Revízió). Change any column, press enter, or leawe edited cell, and press selected column Revízó or go back arrow key to Revízo , and You will see my problem.
    You can test:
    http://infoportal-hu.ddns.net:62080/index.php?module=TablePage&ID=21
    You can login:
    email:allandatatables@gmail.com
    Jelszó:
    AllanDatatables
    If you logged in jump again http://infoportal-hu.ddns.net:62080/index.php?module=TablePage&ID=21

    Thanks
    Gyula


    0 0
  • 12/11/18--03:18: Server Side processing issue
  • Hi, I am working on an old custom .NET web application which uses an old version of jquery and datatables:

    Datatables Version: 1.9.2
    jquery Version: 1.9.1

    Before replying to upgrade them, I can't. It's a task they want to work on, but in the future, so this are the actual js I am working on and must keep them.

    I have a huge dataset to render on a datatable (from 30k to over 200k) so I have choosed to go for the server side processing.

    This is the script code I have on the page:

        $('#dtBasicGrid').DataTable({
            'bProcessing': true,
            "bServerSide": true,
            "sAjaxSource": '<%= ResolveUrl("~/api/LoadBigData") %>',
            "aoColumns": [{
                    "mData":"Name"
                },
                {
                    "mData":"Surname"
                },
                {
                    "mData":"Email"
                }
            ]
        });
    

    And this is the HTML table:

            <table id="dtBasicGrid" class="datatableFilteredPaged" cellspacing="0" width="100%">
                <thead>
                    <tr>
                        <th scope="col">
                            <asp:Literal runat="server" Text="Name" /></th>
                        <th scope="col">
                            <asp:Literal runat="server" Text="Surname" /></th>
                        <th scope="col">
                            <asp:Literal runat="server" Text="Email" /></th>
                    </tr>
                </thead>
                <tbody>
                </tbody>
                <tfoot>
                </tfoot>
            </table>
    

    The JSON I have in response is this one:

    https://jsonblob.com/c95c0e28-fd34-11e8-bf24-d1d4ca98b0e9

    If I open the page, this is the error I find in console:

    jquery.dataTables.min.js:48 Uncaught TypeError: Cannot read property 'length' of undefined
    at Fa (jquery.dataTables.min.js:48)
    at jquery.dataTables.min.js:45
    at Object.success (jquery.dataTables.min.js:132)
    at fire (jquery-1.9.1.js:1037)
    at Object.fireWith [as resolveWith] (jquery-1.9.1.js:1148)
    at done (jquery-1.9.1.js:8074)
    at XMLHttpRequest.callback (jquery-1.9.1.js:8598)

    Can anyone help me please?

    Many thanks
    Jonathan


older | 1 | .... | 2284 | 2285 | (Page 2286) | 2287 | 2288 | .... | 2326 | newer