how to modify the results of a MySQL query in Coldfusion (replace database integer with HTML button/text)
===

I'm using datatables along with Jquery Mobile (server Coldfusion8, MySQL 5.0.88) to display tabular data. While this works fine, I'm trying to integrate AJAX into the table, so whenever the user pages or filters, the database is queried again and updated.

Right now I'm trying to get it to work using this [snippet][1]

    var userTable = $('#users).dataTable({
        "sAjaxSource": "path/to/handler.cfc?method=GetUsers",
        "aoColumns": [
            { "mDataProp": "id" , "sTitle": "ID"},
            { "mDataProp": "name" , "sTitle": "Name"},
            { "mDataProp": "surname" , "sTitle": "Surname"},
            { "mDataProp": "email" , "sTitle": "Email Address"}
          ]
        });

and inside CF:

    <cffunction name="GetUsers" access="remote" output="false" returntype="any" returnformat="json"> 
        <cfquery name="local.qryUsers" datasource="dsn">
          SELECT id, name, surname, email FROM tblUsers
        </cfquery>
 
        <cfscript>
          local.strData = StructNew();
          local.strData['aaData'] = QueryToArray(local.qryCandidates);
          return local.strData;
         </cfscript>
 
    </cffunction>

My problem is I need to modfiy some data from the query, for example I'm storing a column named *status* with values 1,2,3,4,5 and when I'm building the query results, I'm replacing the status number with the correct text in the correct language. Or I have a Jquery Mobile edit/delete controlgroup in every row, which I don't have in the database.

**Question**:  
Is there a way to add this to the query result returned from MySQL to Coldfusion = how can I (a) modifiy query results by looping over a column and replacing a number with some text (status) and (b) how can I add a full column to a query result (edit/delete) button, so I can then feed the whole thing into the AJAX response?

Thanks for help!




  [1]: http://www.jonathonjoyce.co.uk/2011/12/07/using-coldfusion-cfcs-to-return-data-to-datatables-1-8-2/

    