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

How to get aoColumns settings object?

$
0
0

I used to get the aoColumns object using the code below. It seems that I am unable to do this after upgrading. How should I go about doing this in the current version? I can see the object in the .setting() function but have no idea how to get to it.

var oTable = $("#" + tableId).dataTable();
var aoColumns = oTable.dataTableSettings[0].aoColumns;
var columns = [];
for(var i=0; i < aoColumns.length; i++) {
if(aoColumns[i].mDataType == undefined) {
columns.push({sTitle: aoColumns[i].sTitle, mData: aoColumns[i].mData});
} else {
if(aoColumns[i].mDataType != "hide4Export") {
columns.push({sTitle: aoColumns[i].sTitle, mData: aoColumns[i].mData, mDataType: aoColumns[i].mDataType});
}
}
}


How to parse stateSave values

$
0
0

I'm using Datatables on a multi-language application.

I want to notify the user that a search value is set in** stateSave values**.

So how could I parse stateSave values to find out if all "search":""are empty?

{"time":1520535457114,"start":0,"length":10,"order":[[2,"asc"],[0,"asc"],[1,"asc"]],"search":{"search":"","smart":true,"regex":false,"caseInsensitive":true},"columns":[{"visible":true,"search":{"search":"","smart":true,"regex":false,"caseInsensitive":true}},{"visible":true,"search":{"search":"","smart":true,"regex":false,"caseInsensitive":true}},{"visible":true,"search":{"search":"","smart":true,"regex":false,"caseInsensitive":true}},{"visible":true,"search":{"search":"","smart":true,"regex":false,"caseInsensitive":true}}],"ColReorder":[0,1,2,3],"naruto":"kurama"}

**Note: I'm looking for a way to parse the info, I'm not looking for a way to get the info from search fields.
Thanks

Why ColVis will not show remaining fields in a responsive layout?

Dynamically detect which column contains long text then do ellipsis on that column.

$
0
0

So far I'm able to find the long text column by matching column names like :

$.each(TableColumns,function(id,name){
if(column_name == 'description'){
ColumnDefs.push({
targets: id,
render: $.fn.dataTable.render.ellipsis(20)
})
}
})

But most of time the table is generated dynamically. Columns are defined by previous selections.
I'm thinking a way to say:
$.each( data that is returned from ajax call, function(id, value){
if( value.length > 200 characters ){
ColumnDefs.push({
targets: id,
render: $.fn.dataTable.render.ellipsis(20)
})
}
})

But often time there are thousands of data being returned and looping one by one just for testing the length is not so efficient.

Is there a existed Option or plug-in to auto detect the length of data then do ellipsis for that column?

How To Solve This ??

$
0
0

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

MY CONTROLLER ------

@RequestMapping(value = "/yourSpringRequestMappingValue", method = RequestMethod.GET)
@ResponseBody
String getJsonData(HttpServletRequest request,@RequestParam Integer id) {

       JsonObject data  = new JsonObject();
       Collection<JsonArray> allData = new ArrayList<JsonArray>();

       Integer displayLength = Integer.parseInt(request.getParameter("iDisplayLength"));
       Integer displayStart = Integer.parseInt(request.getParameter("iDisplayStart"));         
       Integer pageNumber = (displayStart+displayLength)/displayLength;
       String sortCol = request.getParameter("iSortCol_0");
       String sortDir = request.getParameter("sSortDir_0");
       String search = request.getParameter("sSearch_0");          

       System.out.println("id :-"+id);
       System.out.println("displayLength :-"+displayLength);
       System.out.println("displayStart :-"+displayStart);
       System.out.println("pageNumber :-"+pageNumber);
       System.out.println("sortCol :-"+sortCol);
       System.out.println("sortDir :-"+sortDir);
       System.out.println("search :-"+search);

       ApplicantOutreachMappingExample applicantOutreachMappingExample = new ApplicantOutreachMappingExample();
       com.sl1m.job.vo.outreach.ApplicantOutreachMappingExample.Criteria createCriteria = applicantOutreachMappingExample.createCriteria();
       createCriteria.andIntOutreachIntidEqualTo(id);
       long totalRecord = applicantOutreachMappingMapper.countByExample(applicantOutreachMappingExample);

       List<ApplicantOutreachMapping> ApplicantOutreachMappingList = applicantOutreachMappingMapper.selectByExampleLimit(id,displayLength, 0);

       List<com.sl1m.job.vo.outreach.Applicants> applicantsList = new LinkedList<com.sl1m.job.vo.outreach.Applicants>();

        for (ApplicantOutreachMapping applicantOutreachMapping : ApplicantOutreachMappingList) {
            //System.out.println(applicantOutreachMapping.getIntApplicantIntId());
            com.sl1m.job.vo.outreach.Applicants applicants = applicantsMapper.selectByPrimaryKey(applicantOutreachMapping.getIntApplicantIntId());
            for (com.sl1m.job.vo.outreach.Applicants applicant : applicantsList) {
                applicantsList.add(applicant);
            }               
        }

       for (int i = 0;i < applicantsList.size();i++) {
           JsonArray dataArray = new JsonArray();
           JsonPrimitive no = new JsonPrimitive("1");
           JsonPrimitive noKadPengenalan = new JsonPrimitive(applicantsList.get(i).getVarNric());
           JsonPrimitive nama = new JsonPrimitive(applicantsList.get(i).getVarName());             
           JsonPrimitive noTelefon = new JsonPrimitive(applicantsList.get(i).getVarTelephone());
           JsonPrimitive emel = new JsonPrimitive(applicantsList.get(i).getVarEmail());
           JsonPrimitive link = new JsonPrimitive("link");

          dataArray.add(no);
          dataArray.add(noKadPengenalan);
          dataArray.add(nama);
          dataArray.add(noTelefon);
          dataArray.add(emel);
          dataArray.add(link);

          allData.add(dataArray);
       }

       int echo = 0;

       data.addProperty("draw", pageNumber);
       data.addProperty("recordsTotal",totalRecord);
       data.addProperty("recordsFiltered", applicantsList.size());
       data.addProperty("aaData", allData.toString());
       data.addProperty("sEcho", echo + 1 );
       data.addProperty("iDisplayLength", displayLength);

       String JSON_DATA_AS_STRING = data.toString();

         return JSON_DATA_AS_STRING;            
   }

MY JSP ---

$(document).ready(function(){
$('#example').dataTable({
"processing": true,
"bServerSide": true,
"sAjaxSource": "${pageContext.request.contextPath}/yourSpringRequestMappingValue?id=${outreachid}",
"columns" : [ {
"title" : "No",
"class" : "center"},
{
"title" : "Kad Pengenalan",
"class" : "center"},
{
"title" : "Nama",
"class" : "center"},
{
"title" : "Telefon",
"class" : "center"},
{
"title" : "Emel",
"class" : "center"},
{
"title" : "Slip",
"class" : "center"},
{
"class": 'details-control',
"orderable": false,
"data": null,
"defaultContent": 'default value of column'}],
});
});

Uncaught TypeError: Cannot read property 'length' of undefined

Datatable serverside processing with xml data

$
0
0

how to do pagination on serverside with jquery and xml data (with out php)

columns.adjust().draw()' without getting the Cannot reinitialise DataTabl error?

$
0
0

How do you call .columns.adjust().draw() without getting the Cannot reinitialize DataTable error?

I'm initializing datatables on document.ready. but the headers and columns are not aligned when using scrollX

My thinking was that the adjust() needs to be called outside of that but throws the error. If I place it within document.ready it doesn't do anything?

$(document).ready(function () {

                       var table = $('#logs').DataTable({
                        "scrollX": true,
                        "ordering": false,
                        drawCallback: function () {
                            $('[data-toggle="popover"]').popover();
                        }

                    });

var table = $('#logs').DataTable();
 
$('#container').css( 'display', 'block' );
table.columns.adjust().draw();

Thanks!


One search bar for multiple tables

$
0
0

Hello,
I've been using datatables to display scraped game data on my project, and am displaying three different tables on the same webpage. As you'd imagine each table has it's own search bar, "show 10 entries" button etc. as part of the datatables framework.
I was wondering what the best way of having a single search bar which I created and button that works on the three tables was. Knowing which functions run the search script when the user types in the search bar would work I imagine but I can't seem to find them.
Thank you very much, i'm open to any method of approaching this I just don't have much experience with Javascript yet, but i'm trying to learn

Initializing a datatable with Ajax object as data source

$
0
0

So i don't know if the format of my object is the problem or the data type, but i believe it is quite correct.

MY CODE

i'm quite unsure on what to put on the "ajax" : " "

so i just inserted the return value there.

additional screenshots of the return value

asp.net.mvc Editor cascading

$
0
0

我需要一个详细的例子:包括Controller、javascript、Database及Model的设计,这个问题把我搞晕了。谢谢!

Overlay image in a cell

$
0
0

Hi Guys,
I am pulling an Image for the first cell and some text for the second cell from a database.
I have a responsive layout using the following:

'''
columns: [

        { data: "blogTitle" , title : "Title" , width : '20%',
        render : function ( data, type, row) {
        return '<img style="vertical-align:middle horizontal-align:middle" width="100%"  src="'+data+'"/>';

        }
        },
        {data: "notes", 
        title : "Details",
        width : '80%',
        render: function ( data, type, row ) {
        return  "<div class='setRowHeight' "  + data + " </div>";
        }
        },


                  ]

'''

This all works fine.
I now need to overlay a 'play' button over the image that will scale with the image.

Cheers

Steve Warby

Wrong interpretation of some letters from MYSQL

$
0
0

Hello to everybody,
I have created a table that takes some data from MYSQL. I am using DataTable to customize it. The problem is that some letters aren't read in a correct way. In fact, I found "?" instead of some letters. If I create a table without using DataTable, this problem doesn't appear. How can I fix it?

thanks in advance

How do I access the upload file event.

$
0
0

Hi guys,

I am using the editor with the 'upload-many.php' script.
I also use CKEditor to produce some formatted text with the DESC field.
I create a record then drag & drop image files onto the editor.
I then cut and paste the following into the html source of the DESC.

<p><img alt="" src="http://www.surplusanywhere.com/upload/165.jpg" style="box-shadow:grey 10px 10px 5px; display:block; margin:30px auto; width:75%" /></p>

I do this for each image and replace 165 with the current filename. This gives me nice formatted images.

I now want to do this programatically with each file upload.

So on file uploaded get the uploaded file name ( e.g. 265 )
Update the current DESC field with '.... www.surplusanywhere.com/upload/265.jpg ' added to the end of the data.
Do this for each file upload.

Any ideas ?

Cheers

Steve Warby.

Calendar is not showing right arrow to move to the next month

$
0
0

I have installed Editor in order to use inline features on DataTables.
Everything seems working fine beside the calendar, I have a datetime field to show and edit.
There are no problem in showing date, but when I edit a date, the calendar appears without the right arrow to move to the following month.

Below the Products Installed:
Software Version Updates
DataTables 1.10.16 Up-to-date
AutoFill Not installed
Buttons 1.5.1 Up-to-date
ColReorder Not installed
Editor 1.7.2 Up-to-date
FixedColumns Not installed
FixedHeader Not installed
KeyTable Not installed
Responsive Not installed
RowReorder Not installed
Scroller Not installed
Select 1.2.5 Up-to-date


Can I use the Editor on a dynamically generated table ?

$
0
0

Hi,

Is the Editor only suitable for retrieving a specific table from database, modifying and then saving the data back in the database? I 'm generating a datatable from data coming from multiple tables in the database and I need to only edit a column or two on that and send the data to a different table back in the database ? Is this possible?

Thank you in advance.

Ladies Sexy Bra Sets In Stock

$
0
0

Lot No. 180305

Stocklot Type: Cancelled shipment.

Original Brand Name:LUXE LINGERIE

Ladies Winter Gloves In Stock

$
0
0

Lot No. 180301

Stocklot Type: Cancelled shipment.

Original Brand Name:To be vised

Total Quantity: 27,000 pairs

Made for: Russia

Made in: CHINA

Fabric: 65% Polyester, 30% cotton, 5% Spandex. 48~58 grams per each pair.

Spec: 3 styles, A2251AF, A2219AH and A2272AE. 9,000 pairs for each style. 4 sizes each, #7 (1,800 pairs ), #7 1/2 (2,700 pairs), #8 (2,700 pairs) and #8 1/2 ((1,800 pairs).

Colors: Six colors, each style: black (4,500 pairs), burgundy (900 pairs), brown (900 pairs), gray (900 pairs), yellow (900 pairs) and blue ( 900 pairs).

Quality Status

Advertising Gifts Key USB Flash Drives

Order by in Editor's class

$
0
0

For the first time I needed to use the order by sql since I wanted to return the data from the database already ordered, to my huge surprise I wasn't able to find anything about it. I looked at the Editor class and it doesn't have a function for this....

May I ask why? Is there a reason I'm missing....

Viewing all 82235 articles
Browse latest View live


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