vandronic / jquery-datatables-editable

Automatically exported from code.google.com/p/jquery-datatables-editable
0 stars 0 forks source link

different edit types not working, all fields display as single line text box #154

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. See code below.
2.
3.

What is the expected output? What do you see instead?
For example, multiline text box - just a single normal text box displays.
DropDownList - still just a text box displays.

What version of the product are you using? On what operating system?
DataTables 1.9.4, DataTables.Editable 2.3.3, Jeditable 1.7.1

Please provide any additional information below.

oTable = $('#accountsTable').dataTable({
                "sScrollX": "200%",
                "sScrollXinner": "400%",
                "bScrollCollapse": true,
                "bJQueryUI": true,
                "bPaginate": true,
                "sPaginationType": "full_numbers",
                "bFilter": false,
                "bProcessing": true,

                "sAjaxSource": '/Accounts/GetAccounts?SelectedBusinessArea=null&SelectedRelationshipManager=null&SelectedSearchOption=null',
                "sAjaxDataProp": '',
                "bDeferRender": true,
                "aoColumns": [{}, {}, {}, {}, {}, {}, {},
                { tooltip: 'Click to edit platforms', type: 'textarea', rows: '3' },
                { type: 'select', onblur: 'submit', data: "{'':'Please select...', 'A':'A','B':'B','C':'C'}", event: 'mouseover' }, 
                {} ],

                "aoColumnDefs": [
                { "sName": "AccountNumber", "mData": "AccountNumber", "sClass": "read_only", "sWidth": "80px", "aTargets": [0] },
                { "sName": "AccountName", "mData": "AccountName", "sClass": "read_only", "sWidth": "350px", "aTargets": [1] },
                { "sName": "SortCode", "mData": "SortCode", "sClass": "read_only", "sWidth": "60px", "aTargets": [2] },
                { "sName": "BusinessArea", "mData": "BusinessArea", "sClass": "read_only", "sWidth": "220px", "aTargets": [3] },
                { "sName": "RelationshipManager", "mData": "RelationshipManager", "sWidth": "220px", "aTargets": [4] },
                { "sName": "Balance", "mData": "Balance", "sWidth": "50px", "aTargets": [5] },

                { "sName": "Balance_BackOffice", "mData": "Balance_BackOffice", "sClass": "read_only", "sWidth": "50px", "aTargets": [6] },
                { "sName": "POA_Description", "mData": "POA_Description", "type": "textarea", "rows": "3", "sWidth": "350px", "aTargets": [7] },
                { "sName": "Comments_General", "mData": "Comments_General", "sWidth": "350px", "aTargets": [8] },
                { "sName": "Comments_AccountChecker", "mData": "Comments_AccountChecker", "sWidth": "350px", "aTargets": [9] }
                ]

            }).makeEditable({
                sUpdateURL: "/Accounts/UpdateField"
            });

Original issue reported on code.google.com by jamesj...@gmail.com on 30 Jun 2013 at 10:34

GoogleCodeExporter commented 8 years ago
I fixed this by putting the following into the oDefaultEditableSettings 
onsubmit function:
if(settings.fModifyDisplayValue)
   sNewCellDisplayValue = settings.fnModifyDisplayValue(sNewCellDisplayValue) || sNewCellDisplayValue;

and then implementing fnModifyDisplayValue in my settings:

...
data: function(value, settings) {
   return value.replace(/<br[\s\/]?>/gi, '\n');
},
fnModifyDisplayValue: function(val){
   return val.replace(/[\r\n]/g, '<br />');
}
...

Can we get this added?

Original comment by nathanan...@gmail.com on 31 Jul 2013 at 3:36