Search
3647 results 381-390
Forum
- 4th Jul 2013When hiding columns, hide rows with empty cellsThanks for the link and the clear explanation! Row removal (/hiding) is performed by filtering in DataTables, So what you could do is apply a custom filter to the table which will filter out any row which doesn't have a • character in it. Perhaps something like: [code] $.fn.dataTableExt.afnFiltering.push( function( oSettings, aData, iDataIndex ) { return aData.join(' ').indexOf('•') !== -1; } ); [/code] Regards, Allan
- 22nd May 2013Using pre-compiled javascript templates to render cells like SlickgridThank you.
- 16th May 2013Fancy Box with ReadOnly Data Issues - Pulling Data From CellsI'd suggest, rather than using a static event, use a delegated one: [code] $("#product-table tbody").on( 'click', 'tr', function() { var rowData = table.fnGetData( this ); ... } ); [/code] i.e. move your click handler outside the fnDrawCallback . Allan
- 22nd Oct 2012Conditional Formating of cells in Datatablesthanks Girish, actually, i tried it another inefficient way . 1. I labled those value at server side. 2. $("#summaryTable tr td[id|='negvalcell']").each(function () { $(this).css({ "color": "red" }) }); now the problem is, this formats only for first visible page. when i navigate to next page, no format is done.
- 30th Aug 2012Sorting based on multi-valued cellsThank Allan. So, if understand you correctly, once I develop a custom sort function, clicking on the header will use that function to do the sorting? I.e. the default sorting is gone? So, what if I wanted to keep the default sorting when the table header is clicked, but then attach a different sorting (the custom sorting function) to a link. Is that possible?
- 27th Aug 2012Cells with subrows + sortingThanks! So, I'll have to start getting into the code a little bit ...
- 22nd Aug 2012Sorting column with select elements changes the table DOM from select/html to static text for cellsOne must access the data for the table like this: [code]str = $('td:eq(' + i2 + ') option:selected', oSettings.aoData[ iDataIndex ].nTr).text();[/code] The reason is that aData can be outdated compared to the dom (aoData). When doing that I could also make my custom filtering function a bit more light: [code]$.fn.dataTableExt.afnFiltering.push( function( oSettings, aData, iDataIndex ) { var ret = true; //Loop through all input fields i tfoot that has class 'sl_filter' attached $('tfoot .sl_filter').each(function(i, obj){ //$(this) can be used. Get the index of this colum. var i2 = $("tfoot input").index($(this)); //Create regexp to math var r = new RegExp($(this).val(), "i"); //Get the text var str = $('td:eq(' + i2 + ') option:selected', oSettings.aoData[ iDataIndex ].nTr).text(); /*Test to see if there is a match or if the input value is the default (the initial value of input before it has any fokus/text) */ if(r.test(str) || $(this).val()=="Search"){ //Return true only exits this function return true; }else{ /*Return false returns both function an .each. Retain 'false' in a variable scoped to be reached outside the .each */ ret = false; return false; } }); //Return true or false return ret; } ); [/code]
- 3rd Aug 2012Sorting Dynamic Table Data with Empty CellsI've posted my debug data if anyone could help :) Code: oveyak
- 22nd Nov 2011Numeric sort with "NA" in some cellsWriting your own sort routines and type is pretty simple. for columns you want this sorting on, set sType to "numeric_ignore_nan" and paste in the not-a-number routines below (non-numbers always sorted to bottom). [untested, but should work, or need minor tweaking if I mixed up the negative and positive 1's] [code] jQuery.fn.dataTableExt.oSort['numeric_ignore_nan-asc'] = function(x,y) { if (isNaN(x) && isNaN(y)) return ((x < y) ? 1 : ((x > y) ? -1 : 0)); if (isNaN(x)) return 1; if (isNaN(y)) return -1; x = parseFloat( x ); y = parseFloat( y ); return ((x < y) ? -1 : ((x > y) ? 1 : 0)); }; jQuery.fn.dataTableExt.oSort['numeric_ignore_nan-desc'] = function(x,y) { if (isNaN(x) && isNaN(y)) return ((x < y) ? 1 : ((x > y) ? -1 : 0)); if (isNaN(x)) return 1; if (isNaN(y)) return -1; x = parseFloat( x ); y = parseFloat( y ); return ((x < y) ? 1 : ((x > y) ? -1 : 0)); }; [/code]
- 30th Sep 2011Ajax calls from inside of cells!thanks for the responses I found it useful! I'm gonna give a try in the following days. best regards