         return data.model if data.model?.isModel
         attrs = if row.attr('id') then { id: parseInt(row.attr('id')) } else {}
         for field,i in @columnDefinitions
-            attrs[field.field] = data[i]
+            attrs[field.id] = data[i]
         data.model = new @modelClass(attrs,ignoreUnsaved:true)
 
     adjustColumnWidth: ->

        this.dt_api = this.dataTable.api()
        this

    buildModels: (d)->
        params = {
            o: {}, s: d.start, l: d.length||100, df:'array',
            f: ['id'].concat(_.pluck(@columnDefinitions, 'field'))
        }
        if ! _.isEmpty( query = @recordQuery.asParams() )
            params['q']=query
        for order in d.order
            column = @recordQuery.fields.at(order.column)
            params['o'][column.field] = order.dir
        params



        align = switch query_field.type
            when 'integer','bigdec' then 'r'
            else 'l'
        { title: query_field.title, id: query_field.id, className: align, "targets": [ index ] }

    _dataFromModel: (model)->
        data = []
        for field,i in @columnDefinitions
            data.push( model.get(field.id) || '' )
        data
