Quantcast
Channel: DataTables 1.9 — DataTables forums
Viewing all 1816 articles
Browse latest View live

sScrollY and DataTables default values

$
0
0
Hi!

I noticed a porblem in DataTables 1.9.4: I'm using
sScrollY: "1"
on all my Tables, then the table-header stays in place (fixed header) and the entries are scrollable.
This works perfectly.

But now I wanted to set some default values for all DataTables with
$.extend($.fn.dataTable.defaults, {
                "bPaginate": false,
                "bLengthChange": false,
                "bFilter": false,
                "bScrollCollapse": false,
                "bSort": true,
                "bInfo": false,
                "sScrollY": 1
});

As soon as I do that (it doesn't matter for which values I set default values, can also be only one, "bSort" for instance), the sScrollY-option doesn't work anymore on all tables.

When i set the default values in the JS-file directly, everything works like a charm. But i have to set the oLanguage property on runtime because I have to set the values depending on the users language.

Any help would be greatly appreciated!

JQuery DataTable Column Filter - External Form - pre-selected filter

$
0
0
Hi,

we use the Query DataTable Column Filter Plugin (External Form)
http://jquery-datatables-column-filter.googlecode.com/svn/trunk/external.html]
to get our data filtered. Example:
{ type:"select", sSelector: "#Filter", values: ['Option1', 'Option2', 'Option3'] }

I would like to set the first Option as default (not "All"), Option2 (and Option 3 and so on) should be a subset of Option1 (that means it should filter the data for two key words (Option1 and Option2 ) but should only show Option2) and the All-Option (unfiltered table) should be shown as last one in the list.

Any ideas how to make this work?

Regards, aluscc

role="alert" on tbody

$
0
0
I was wondering what the purpose of role="alert" being added on the <tbody> in DataTables 1.9 is. I'm not totally familiar with all the ARIA roles, but it seems, at least using VoiceOver on OS X 10.8.3, that this one makes the table content inaccessible. I was just wondering if there was a specific reason it's there that I'm not seeing before I go trying alternatives.

Highlighting Entire Row on Hover with Fixed Columns

$
0
0
I have a table with fixed columns, I've set up CSS styles to highlight the rows on hover, but only the fixed columns highlight when I hover over them or the non-fixed columns when I hover over them.

Is it possible to have the entire row (fixed and non-fixed columns) highlight when I hover on any cell in the row?

Thanks.

Here's the CSS I'm using to highlight the rows (only "even" included for example):
tr.even:hover td,
#mtTable tr.even:hover td,
#mtTable tr.even:hover td.sorting_1 { background-color: #FFFF88;
                                      border-top: 2px solid #FF0000;
                                      border-bottom: 2px solid #FF0000; }

The first line, "tr.even:hover td", provides the highlighting for the fixed columns, the other two, beginning with "#mtTable", provide the highlighting for the non-fixed columns.

How to call custom struts action without ajax for buttons on datatable

$
0
0
I have created a datatable with checkboxes and customs buttons(for ex: Edit Name).
When user clicks on EditNAmebutton, how do i call struts 2 action.
We do not have Ajax on our project.

Thx for any help.

Acquerie

How to join two javascripts in the correct way?

$
0
0
1. How to join two javascripts in the correct way?
2. How to change $ into jQuery setting?

<script type="text/javascript" charset="utf-8">
$(document).ready(function() {
var oTable = $('#example').dataTable( {
"bSortClasses": false
} );

oTable.$('td').hover( function() {
var iCol = $('td', this.parentNode).index(this) % 5;
$('td:nth-child('+(iCol+1)+')', oTable.$('tr')).addClass( 'highlighted' );
}, function() {
oTable.$('td.highlighted').removeClass('highlighted');
} );
} );
</script>
<script type="text/javascript" charset="utf-8">
$(document).ready(function() {
$('#example').dataTable( {
"fnDrawCallback": function ( oSettings ) {
var that = this;

/* Need to redo the counters if filtered or sorted */
if ( oSettings.bSorted || oSettings.bFiltered )
{
this.$('td:first-child', {"filter":"applied"}).each( function (i) {
that.fnUpdate( i+1, this.parentNode, 0, false, false );
} );
}
},
"aoColumnDefs": [
{ "bSortable": false, "aTargets": [ 0 ] }
],
"aaSorting": [[ 1, 'asc' ]]
} );
} );
</script>

How to control colour inside rows?

$
0
0
I have seen some rows are marked in color. Can be this modified and how is correct way? Some are red some green...Need help.

Break on column, need custom sort or fnDrawCallback?

$
0
0
I am outputting my table with the first column only showing the data the first time unless it is different... it is the same as using BREAK ON in Oracle..

Here is the DataTables live preview..

http://live.datatables.net/amabuw/2

As you can see the first column is like

IE
...
...
...
Trident
...
...
Gecko


What I would like to do is treat the empty column as the previous cell that had a value to it so..

IE
...
...
...

the empty columns in this case would be seen as IE until it changed to Trident or something else.

Would I have to do this using a custom sorter or using the fnDrawCallback?

If it is a custom sorter, I am not sure how to go about creating it. I know I need to hold onto the non empty value and when it changes update it, otherwise use that as the sorting text. Just cant seem to wrap my head around the logic, so I need some help.

If it is a fnDrawCallback() is there a way to set the value Datatables is looking at for that cell without setting the value of that cell?

Any assistance is greatly appreciated!!

Update DataTables Libraries to work with jQuery 1.9 or higher

$
0
0
We have issues with datables using jQuery 1.9 or higher. Most of this js files library are still using jQuery 1.5 and there are several methods that are no longer available in jQuery 1.9. For example .live method is no longer available starting jQuery 1.7

Data issues with firefox, ie, and chrome

$
0
0
This problem is intermittent.
I get data in json, drop it into a knockout observable array, and load that into aaData. The datatable will sometimes render the data but this is very intermittent. I have tried json with and without fields .ie ["field":"data"] and ["data"] same results.

I can see the data all of the way to the control, use it in other places without issue. Has anyone run into this issue before?

jquery-1.8.2
DataTables-1.9.4

Export Button

$
0
0
Hello Allan,

Am using server side data source. I have following quires,

1) How can i export the whole table- Now when i try, it is exporting only the visible rows of the Data table(like 10 rows of 1000 rows).

2) How to include the hidden column in the export - There are just 4 rows displayed on the datatable out of 10 columns. While downloading the whole 10 column should get downloaded.


Is there a way to sort these out..

Thanks.

Filter a table by another means

$
0
0
ok, i have a databable being populated, which contains a reference field. I also have ASP.NET repeater, which displays subset of the items being displayed in the datatable, which also happens to have the reference field. I've marked the repeater reference as a hyperlink, and want ot know if it is possible, to filter the datatable based upon the value of the item being selected in the repeater?

i want latest pagination in datatable

$
0
0
hi all,

i am new to data tables. this plugin is very help full to me. but i need latest pagination which is have select page umber also. so how can i fix this one datatable plz help me.

Thanks & regards,
VEnkatGoutham.

Sorting on the decimal values are not working

$
0
0
I have created the table with the data table 1.9 but my
  sType": "formatted-num"  
is not working for me

i have created jsfiddle http://jsfiddle.net/hALDK/19/


The column Header
BRR
is not sorting.

i am using


$(document).ready( function() {
  $('#myTable').dataTable( {
    "sPaginationType": "full_numbers",
    "aoColumns": [null,null,null,null,null,null,null,null,{ "sType": "formatted-num" },null] 
  } );

} )

Colreorder and save state

$
0
0
I am using data table and allowing user to re-order columns , there is a refresh function which will make a AJAX call to fetch the JSON from server and re-initialize and load the data table every 1 minute.

I have 8 columns out of which 1 column is hidden and initial sorting is based on this hidden column.

PFB the function which is called when the page loads and also every minute for refreshing the data table :

bindDefaultTable : function(data) {

mapobjects.defaultCounter = 0;
mapobjects.oDefaultTable = $('#records-short').dataTable({
"fnRowCallback" : function(nRow, aData, iDisplayIndex) {
return MapUI.attachZoomOnRowClickEvent(nRow, aData.lat, aData.lon, aData.fixQuality);
},
"bStateSave": true,
"bProcessing" : true,
"bPaginate" : true,
"bLengthChange" : true,
"iDisplayLength" : Global.rowLength,
"bSort" : true,
"sScrollY" : mapTableLength,
"bInfo" : false,
"bAutoWidth" : false,
"bDestroy" : true,
"oLanguage" : {
"sSearch" : ""
},
"sDom" : 'R<"clear">T<"clear">lfrtip',
"aaSorting" : [ [ 1, "desc" ] ],
"oTableTools" : {
"sSwfPath" : "js/csf/DataTables-1.9.4/extras/TableTools/media/swf/copy_csv_xls_pdf.swf",
"aButtons" : [ {
"sExtends" : "pdf",
"sFileName" : "livefleet.pdf",
"sButtonText" : "",
"sPdfOrientation" : "landscape",
"sPdfMessage" : "",
"sTitle" : "LiveFleet",
"mColumns" : "visible"
}, {
"sExtends" : "xls",
"sFileName" : "livefleet.xls",
"sButtonText" : "",
"sPdfOrientation" : "landscape",
"sPdfMessage" : "",
"sTitle" : "LiveFleet",
"mColumns" : "visible"
} ]
},
"aaData" : data,
"aoColumns" : [ {
"mDataProp" : "vehicle",
"sWidth" : '5%'
}, {
"mDataProp" : "dateAndTime",
"sWidth" : '5%',
"bVisible" : false
}, {
"mDataProp" : "convertedTimeToUserTimze",
"sWidth" : '5%',
"iDataSort" : 1
}, {
"mDataProp" : "lastLocation",
"sWidth" : '5%'
}, {
"mDataProp" : "status",
"sWidth" : '5%'
}, {
"mDataProp" : "lastActivity",
"sWidth" : '5%'
}, {
"mDataProp" : "speed",
"sWidth" : '5%'
}, {
"sType" : "title-numeric",
"mDataProp" : "stop",
"sWidth" : '5%'
} ],
"aoColumnDefs" : [ {
"fnRender" : function(oObj, sVal) {
var id = oObj.aData.vehicleId;
return '<a id=' + id + ' title="See breadcrumb detail" class="breadcrumb">' + sVal + '</a>';
},
"aTargets" : [ 0 ]
}, {
"fnRender" : function(oObj, sVal) {
if (oObj.aData.fixQuality != "0" || oObj.aData.fixQuality != false) {
sVal = "";
}
return sVal;
},
"aTargets" : [ 3 ]
}, {
"fnRender" : function(oObj, sVal) {

return jQuery.i18n.prop(sVal.toString());
},
"aTargets" : [ 4 ]
}, {
"fnRender" : function(oObj, sVal) {
return jQuery.i18n.prop('eventType.' + sVal.toString());
},
"aTargets" : [ 5 ]
}, {
"fnRender" : function(oObj, sVal) {
if (sVal == null) {
sVal = 0;
}
var calcValue;
var val = sVal * kiloToMileConstant;
if (val == 0) {
calcValue = val;
} else {
var end = val.toString().indexOf(".");
calcValue = val.toString().substring(0, end);
}
var cls = (parseInt(calcValue) > 0) ? "moving" : "";
return '<span class="' + cls + '">' + calcValue + " " + GlobalConstant.MPH + '</span>';
},
"aTargets" : [ 6 ]
}, {
"fnRender" : function(oObj, sVal) {
var str = Global.convertMinToDaysHrsAndMins(sVal);
if (sVal == null || sVal.toString().trim() == "" || parseInt(sVal) == 0) {
sVal = 0;
}
return "<span title=" + sVal + ">" + str + "</span>";
},
"aTargets" : [ 7 ]
} ],
"fnCreatedRow" : function(nRow, aData, iDataIndex) {
$(nRow).addClass("marker-" + (iDataIndex + 1));
},
"fnInitComplete" : function(oSettings, json) {
Global.addExportButtons("records-short", "table-sm");
Global.filterOnPaste(oSettings.sTableId);
},
"fnDrawCallback" : function(oSettings) {
if ($(".active").attr("id") == "notbreadcrumb") {
MapUI.createMarkersFromTable(oSettings);
}
}
});

if (mapobjects.oDefaultTable != null) {
mapobjects.oDefaultTable.fnAdjustColumnSizing();
}
},

the problem I am facing is if I RE-ORDER columns and after a minute refresh happens , the table headers and table data are not in synch as refresh is loading the table data in the predefined order based on indexes in aoColumnDefs.

can you please suggest a way to solve this?

WHAT I WANT : if user re-orders the columns and refresh happens , the table should be refreshed by retaining the order of columns selected by user.

should I use any combination of bRetrieve , bDestroy ??

iDisplayLength always -1

$
0
0
I have a data table using Scroller with server-side processing and the following init:
oTable= jQuery('#request-grid').dataTable({
                "bProcessing": true,
                "bServerSide": true,
                "bPaginate": false,
                "bFilter": false,
                "bScrollCollapse": false,
                "sScrollY": "100px",
                "bDeferRender": true,
                "sScrollX": "100%",
                "sAjaxSource": '/ajax/requests-db.php',
                "sDom":'<"grid-top"lfrip<"clear">>tS<"grid-bottom">',
                "oScroller": {
                        "loadingIndicator": true,
                        "trace": true
                },
                "fnRowCallback": function ( nRow, aData, iDisplayIndex ) {
                    row_css = status_to_class (parseInt(aData[7]));
                    if (row_css !== false ) jQuery(nRow).addClass(row_css);
                },
                "fnInitComplete" : function(oSettings, json) {
                    adjust_table_height();
                    console.log("oTable initialized " + oTable.fnSettings().oScroll.sY);
                },
                "fnCreatedRow": function( nRow, aData, iDataIndex ) {
                    jQuery(nRow).children("td").wrapInner("<div />")
                }
                
            });
I have a strange problem: in the ajax query to the server iDisplayLength value always -1
sEcho:15
iColumns:7
sColumns:
iDisplayStart:0
iDisplayLength:-1
mDataProp_0:0
mDataProp_1:1
mDataProp_2:2
mDataProp_3:3
mDataProp_4:4
mDataProp_5:5
mDataProp_6:6
iSortCol_0:0
sSortDir_0:asc
iSortingCols:1
bSortable_0:true
bSortable_1:true
bSortable_2:true
bSortable_3:true
bSortable_4:true
bSortable_5:true
bSortable_6:true

and my servers-side processing script return all records. This causes a problem when a large number of rows in the table.
Also, during scrolling, the table not make ajax query for additional data-loading like this scroller example: http://datatables.net/release-datatables/extras/Scroller/server-side_processing.html
Who can help solve it?
my table debug data http://debug.datatables.net/exuxon

Dynamic condition sorting column.

$
0
0
Hello every one, I'm newbie of DataTable. I have a trouble with sorting multiple column. For example: I have 5 columns:
When I click header of column 1, data in column 1 will sorted ASC, column 2 ASC.
When I click header of column 2, data in column 2 will sorted ASC, column 3 DESC.
When I click header of column 3, data in column 3 will sorted DESC, column 1 ASC...
Please tell me how to implement? do you show me an example.
Thank you so munch.

sDefaultContent, and Requested unknown parameter

$
0
0
Hi,
I am running DataTables on my company IntraNet.
I have a page which handles .csv files (of various composition) and need to build my table on the fly.

I am using the:
aoColumns [ null, null, null, null, null, {"mData":null, "sDefaultContent": "Edit"}]
and
the aaData method for building my table dynamically.

When I do this everything runs fine, except that the number of nulls does not always match my needed fields.

$('#example').dataTable ({
    "aoColumns": myColumns,  //my list This throws the error..

  // "aoColumns:[null,null,null,null,{"mData":null,"sDefaultContent":"Edit"}], 
                   //this works but I can't anticipate the number of columns.
                   //plus it has the ending row value of EDIT in the table.

   "aaData": fieldAttributes, //my list values..
   "sScrollX": "100%",
   "sScrollY": 200,
   bDestroy: true,
   bPaginate: true,
   bFilter: true,
   bAutoWidth:true,
   bSort:true
});

Is there a way to dynamically create the number of 'nulls'?

Andy

jQuery DataTables - I cannot get the desired effect I want

Help with tabs

Viewing all 1816 articles
Browse latest View live