Type Detection Plug-in

Type Detection Plug-in

amithaniamithani Posts: 4Questions: 0Answers: 0
edited February 2011 in Plug-ins
Hi Allan,

I am using the Type Detection plug in per your documentation in Plug-ins > Type Detection and it doesn't seem to be working for me. Basically I have a few columns in my table that have spaces and other html code along with it. I am removing the white space and all the html prior to checking the datatype. Here is the code snippet:

[code]
jQuery.fn.dataTableExt.aTypes.push(
function ( sData )
{
//Removing HTML, comma and space from the input data
sData = String(sData).replace(/<[^>]*>?/g, "").replace(/ /g, "").replace(/,/g, "");
sData = String(sData).replace( /<.*?>/g, "" );

var sValidChars = "$0123456789.-,";
var Char;

/* Check the numeric part */
for ( i=0 ; i

Replies

  • amithaniamithani Posts: 4Questions: 0Answers: 0
    Hi Allen,

    I looked at the live example where you have used unshift instead of push and it is working fine with unshift.

    Thanks
  • allanallan Posts: 61,714Questions: 1Answers: 10,104 Site admin
    That's a very good point, using 'push' the built-in methods will take priority - which isn't always what is wanted. The one thing however is that unshift doesn't work in IE6... At that point something a little more complicated is probably needed. I wonder what it watch matching on with the internal methods - it shouldn't have matched anything when using "\$[0-9\.-]"...

    Allan
This discussion has been closed.