hikalkan/jtable — pull request #1221 by rday (2014-03-28 12:56:40+00:00)
Title: Allow users to specify a 'custom' type for a field, and run the display ...

...function for that field when adding a new record.

My specific use case was to allow users to upload a file. By using this 'custom' field type, I can upload the file, modify the meta inside my record, and save everything appropriately.

```javascript
fields: {
upload: {
list: false,
edit: false,
type: 'custom',
title: 'Upload File',
display: function(data) {
var $fieldView = $('

');
var $upload = $('', {
'type': 'file',
'id': 'file_upload',
'name': 'files'
});
// This will be wrapped with the appropriate jtable divs
$fieldView.append($upload);

// When we receive the file info, this runs
$upload.bind('change', function() {
var s3upload = new S3Upload({
onFinishS3Put: function(url, signedResult) {
// Now that everything has finished, we can modify the Edit-url
// element, and when jtable saves the record, the correct url will be saved
$('#Edit-url').val(url);
}
});
});

return $fieldView;
}
}
}
```