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

Individual column searching (text inputs) does not show input text after page changing

$
0
0

Hello,

I’m using the “Individual column searching (text inputs)” explained in

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

but I have a problem.

When I change page and later come back, the values written inside the input controls are not displayed. The filters work (i.e. the columns contain only the filtered results), but the searched words are not visibile. The global Search is instead populated.

In DataTable constructor I set:

  `stateDuration: -1, //-1 means session storage
  `stateSave: true, 

and

    `initComplete: function () {
    `var r = $('#myTableId tfoot tr');
      `r.find('th').each(function(){
        `$(this).css('padding', 8);
      `});
      `$('#myTableId thead').append(r);
      `$('#search_0').css('text-align', 'center');

      `var api = this.api();

      `// Apply the search
      `api.columns().every(function() {
        `var that = this;       
        `$('input', this.footer()).on('keyup change', function() {
          `if (that.search() !== this.value) {
            `that.search(this.value).draw();
          `}
            `});
        `});
     `},

Could anyone help me figure out where I'm wrong?

Thanks in advance, Leonardo


jQuery DataTables RowReorder - disable row from being sorted/reordered

$
0
0

I want to be able to disable a row from being reordered.

The behavior that I want is that when I am dragging rows to be reordered, I want the row to stay at the bottom position and never be reordered.

I was able to set it up such that this row cannot be selected for reordering; however, other rows can be placed underneath.

I also tried to set things up where I remove the row from the table while reordering happens; however, this causes some issues where some of the rows disappear.

alphabetSearch bug with mixed case

$
0
0

Hi -

I have alphabetSearch working nicely in a table. Recently data was added to the table with mixed case - specifically, lowercase i as the first letter of the word.

I was able to add [a-zA-Z] to get it to bin correctly, but I can't see why it doesn't return the lowercase row. Any thoughts?

Why is filtering/searching not firing the Processing event?

$
0
0

I've set up the processing dialog in my table definition and the message comes up fine when I sort a column. Unfortunately, the processing event doesn't fire when I use the search box or programatically filter the columns. The reference manual says "This event is fired when DataTables is doing some kind of processing - be it, sorting, filtering or any other kind of data processing".
Am I wrong to assume that it should fire for search or filtering? I know that the column filtering is really column searching so I figured the search box should also fire the processing event. I was also wondering if paging should fire the processing event?
Thanks.

Trying to calculate a field based on other answers

$
0
0

Hi,
I am new to this and trying to work through a solution.
My goal is to have users enter data and have two fields hidden on the form.
Based on other answers a user puts while filling out the form, these first two fields will get values added.
I am thinking this is mostly math, as the first field can be straight multiplication with a value assigned to each drop down to figure out its value, and then the second field will just display text based on the first value.

I have the basics of the table setup, trying to figure out how to approach this piece:
https://newyorklife.acms.com/nestfinder/

Any advice is greatly appreciated.

Thanks,
Brian

Problems with default datetime in editor

$
0
0

I'm having a strange problem with a datetime field in the editor: When I edit an existing row, the particular field in question displays the datetime field as [object Object] the first time I edit a row. After that, it always defaults to the current date in the editor field, no matter what the previously saved date is.

My Javascript code for the field in question is:

            {
                "label": "Date Due: ",
                "name": "duedate",
                "type": "datetime",
                "placeholder": "Choose Due Date",
                                "dateFormat": $.datepicker.ISO_8601,
                "opts": { firstDay: 0 }
            },

I do some computation server-side to facilitate the filtering requirements for this field. My PHP code for this field is:

        Field::inst( 'duedate' )
            ->validator( Validate::notEmpty() )
            ->validator( Validate::dateFormat( 'Y-m-d' ) )
            ->getFormatter( function( $val, $data, $opts) {
                global $id;
                $filterDate = '';
                $displayDate = date("Y-m-d", strtotime( $val) );
                if ( strtotime($val) < strtotime('today') ) {
                    $filterDate = 'overdue';
                } elseif (strtotime($val) === strtotime('today')) {
                    $filterDate = 'today';
                } elseif (strtotime($val) === strtotime('tomorrow')) {
                    $filterDate = 'tomorrow';
                } else {
                    $filterDate = 'beyond';
                }
                //  Now build an object in JSON format
                $dueDateObj = (object) [
                    'filterDate' => $filterDate,
                    'displayDate' => $displayDate
                ];
                return $dueDateObj;
            } )
            ->setFormatter( function( $val, $data, $opts) {
                return date("Y-m-d", strtotime($val));      
            } ),

I've tried a couple of variations that have not helped, because I do't really see another way to do what I'm aiming at.

Ajax onchange for fill dropdown

$
0
0

I want to fill drop down using ajax according to other dorpdown selection.
I'm trying much but no output
please help me

The export button does don't appear after filter data

$
0
0

Good day team.
I use the yajra datatable server side to display data to the table and export it. When I load data for the first time the export buttons appear but when I filter the data by the date the export buttons disappear. Please, anyone can help with this.

loadCustomer()
        var startDate;
        var endDate;
        var table;
        $(document).ready(function(){
            $('#filter').click(function(){
                var status = $('#status').val();
                table.destroy();
                loadCustomer(startDate,endDate,status);
            })

            $('#refresh').click(function(){
                startDate = ''
                endDate = ''
                status = ''
                table.clear().draw(); 
            })
        })

        function loadCustomer(start_date = '', end_date = '', status = ''){

            table = $('#customer_table').DataTable({
                dom: 'Bfrtip',
                buttons: ['csv','print', 'excel', 'pdf'],
                processing:true,
                serverSide:true,
                ajax:{
                    url:'{{ url('report/customer/list') }}',
                    data:{start_date,end_date,status}
                },
                
                columns:[
                    {
                        data:'DT_RowIndex',
                        name:'DT_RowIndex'
                    },
                    {
                        data:'applicant_name',
                        name:'applicant_name'
                    },
                    {
                        data:'applicant_phone',
                        name:'applicant_phone'
                    },
                    {
                        data:'applicant_address',
                        name:'applicant_address'
                    },
                    {
                        data:'street_name',
                        name:'street_name'
                    },
                    {
                        data:'user_code',
                        name:'user_code'
                    },
                    {
                        data:'status',
                        name:'status'
                    },
                    {
                        data:'meter_number',
                        name:'meter_number'
                    },
                    {
                        data:'account_type_name',
                        name:'account_type_name'
                    },
                    {
                        data:'area',
                        name:'area'
                    },
                    {
                        data:'plot_number',
                        name:'plot_number'
                    },
                    {
                        data:'house_number',
                        name:'house_number'
                    },
                    {
                        data:'owner_name',
                        name:'owner_name'
                    },
                    {
                        data:'owner_phone',
                        name:'owner_phone'
                    },
                    {
                        data:'water_closet',
                        name:'water_closet'
                    },
                    {
                        data:'unrinals',
                        name:'unrinals'
                    },
                    {
                        data:'baths',
                        name:'baths'
                    },
                    {
                        data:'stand_pipes',
                        name:'stand_pipes'
                    },
                    {
                        data:'others',
                        name:'others'
                    },
                    {
                        data:'created_at',
                        name:'created_at'
                    }
                ]
            })
        }

Edited by Kevin:  Syntax highlighting. Details on how to highlight code using markdown can be found in this guide


I want to fill data in a cell with ajax data

$
0
0

I want to put data in cells as the above image when button click it gets data pass through ajax thenprocess it then retun and show it the blank cell

DataTable not populating on first load

$
0
0

Hello,
I have a button that passes an Id and opens a modal containing DataTable. On first click, I don't see the table getting to my populate method. Subsequent clicks lead to datatable being populated.

in my document.ready, I have

$("#myModal").on("shown.bs.modal", function () {
if (!initialized) {
initialized = true;
myTable = $('#myTable').DataTable({
"processing": true,
"serverSide": true,
order: [[1, "desc"]],
searchDelay: 1000,
deferLoading: 0,
scrollY: 300,
scrollCollapse: true,
columns: [
{ data: "Col1" },
{ data: "Col2" }
],
"ajax": {
"type": "POST",
"url": baseUrl + "api/Search/GetData",
"data": function (d) {
d.myId = myId;
}
},
preDrawCallback: function () {
if (dontMakeAjaxCall) {
dontMakeAjaxCall = false;
return false;
}
return true;
}
});
}
});

    and my button click has

$(".OpenModal").click(function () {
..get my ID
$('#myModal').modal('show');
myTable.ajax.reload();
});

  thanks for your assistance

DataTable column header size smaller than data size on load

$
0
0

Hello,

After my DataTable loads, the formatting seems to be messed up.

The table headers are of much shorter length than the data in the rows of the columns.

After I click on one of the headers, all headers get set to required length.

Thanks,

DataTable sorting column on click

$
0
0

Hello,

I have data coming from DataTable as

            var aaData = GetData().AsEnumerable().Select(x => new {
                Id = x["myId"],
                Desc = x["Desc"]                 
            });

How do I set sorting when user clicks on sorting buttons on columns?

Thanks,

[Tab between columns] + [server-side] + [Editor1.9.2] not working

Cannot reset password - datatables account

$
0
0

Hi, I never did receive the password reset email (semenoff@yahoo.com) - that was at least a day ago. When I try to create another account, it says the email is unavailable. I had to create another account with another email to post this message.

I want auto increment of session time

$
0
0

As in the above picture i have generate session time by login DT (-)minus time now. So i want that session time to auto change every second as time pass session time will increase.

Example:
First entry is alpha5, login DT is: 23/Dec 06:51 am, generated session time is 3D : 11H : 34M : 30S, i want that 3D : 11H : 34M : 30S to change every second like:
3D : 11H : 34M : 31S
3D : 11H : 34M : 32S
3D : 11H : 34M : 33S

etc


Replacing a carriage return in a child row

$
0
0

I am trying to replace a carriage return in a child row with the replace function. I know that I can do it easily in the columns options with the render and replace function, but I am not quite sure how to do it in a child row.

Uncaught TypeError: Cannot read property 'isActive' of undefined

$
0
0

i have a problem
i need make a text base on database value in asp.net zero
im send the value from service to datatable but im see the message error same in the title
this my code

var getFilter = function () {

    var filter = {
        programName: $("#InstitutionFilter").val(),
        programType:  $("#InstitutionFilter").val(),
        InstitutionName:  $("#InstitutionFilter").val()
    };
    return filter;
}
         var _programService = abp.services.app.program;
        var _$programsTable = $("#ProgramsTable");
        var dataTable = _$programsTable.DataTable({
        paging: true,
        serverSide: true,
        processing: true,
        listAction: {
            ajaxFunction: _programService.getPrograms,
            inputFilter: function () {
                return getFilter();
            }
        },
        columnDefs: [
            {
                className: 'control responsive',
                orderable: false,
                render: function () {
                    return '';
                },
                targets: 0
            },

            {
                targets: 1,
                data: null,
                orderable: false,
                autoWidth: false,
                defaultContent: '',
                rowAction: {
                    text: '<i class="fa fa-cog"></i> ' + app.localize('Actions') + ' <span class="caret"></span>',
                    items: [
                        {
                            text: function (data) {
                                if (data.record.isActive) {
                                    return "DisActive"
                                } else {
                                    return "Active"
                                }
                            },

                            action: function () {

                            }
                        },    {
                            text: app.localize('Delete'),
                            visible: function () {

                            },
                            action: function () {

                            }
                        }
                    ]

                }
            },
            {
                targets: 2,
                data: "programName"
            },
            {
                targets: 3,
                data: "programType"
            },   {
                targets: 4,
                data: "institutionName"
            }
        ]
        });

 function getProgram() {
        dataTable.ajax.reload();
    }

How to print table with background image watermark in all pages?

$
0
0

image appears only in first page

extend: 'print',
customize: function (win) {

                    $(win.document.body)
                        .css('font-size', '10pt')
                        .prepend(
                            '<img src="http://datatables.net/media/images/logo-fade.png" style="position:absolute; top:0; left:0;" />'
                        );
                    $(win.document.body).find('table')
                        .addClass('compact')
                        .css('font-size', 'inherit');
                }

reorder on linking table??

$
0
0

i have this situation:
i have in database table called day-trip and table called Trip
i have linking table between day-trip and trip called Trip_DayTrip, in this table i have the day-trip and trip id as primary key and another column named order.

in my client side, i have option to see all the day-trips in table or to see the day-trips of one trip.
i want to able to reorder the day-trips of one trip, but i must say that the table that show the day-trip of the trip is the same that show all the day-trips, the table just get id of trip and filtered.

can i make this work with editor?

Validation.Unique on table with number or strings (column datataype:nvarchar(250))

$
0
0

Validation.Unique not working when in column of navarcher have
numbers alone or string.. for exmple:

when i try to insert value that already in table its says:
"Conversion failed when converting the nvarchar value 'Not Defined' to data type int."

Viewing all 81366 articles
Browse latest View live


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