Treating a column as String in AutoFill

Treating a column as String in AutoFill

velovelo Posts: 11Questions: 0Answers: 0
edited October 2011 in Plug-ins
AutoFill seems to detect a column as numeric if it matches the pattern in fnPrep. I've tried sType as a definition of aoColumnDefs and using fnStep override. FnStep override does not work for large numbers as its converted to an exponent number. Is there a work-around for this?

Replies

  • velovelo Posts: 11Questions: 0Answers: 0
    edited October 2011
    as a workaround we can pass sType to fnPrep and skip the substring unless its numeric.

    the value of sType is available from [code] this.s.dt.aoColumns[iColumn].sType [/code]
  • amurdockamurdock Posts: 10Questions: 0Answers: 0
    I am having the same problem. I want to disable the increment from happening ( I want to use this function to copy values) Is there any simple way to do this?

    Thanks
    -ADM
  • tamersalamatamersalama Posts: 3Questions: 0Answers: 0
    edited October 2011
    I thought this should be easy to change. But unfortunately it isn't (not without hacking the library).

    The way I went about it is by changing the _fnPrep function (AutoFill.js):


    [code]
    ...
    "_fnPrep": function ( sStr)
    {
    var aMatch = sStr.match(/[\d\.]+/g);

    if ( !aMatch || aMatch.length === 0 ) {
    ...
    [/code]
    became
    [code]
    ...
    "_fnPrep": function ( sStr, colType)
    {
    var aMatch = sStr.match(/[\d\.]+/g);

    if ( !aMatch || aMatch.length === 0 || colType === 'string' || colType === 'html')
    [/code]


    And for the call to the function
    [code]
    var oPrepped = this._fnPrep( sStart, this.s.dt.aoColumns[iColumn].sType)
    [/code]
This discussion has been closed.