Quantcast
Channel: Recent Discussions — DataTables forums
Viewing all articles
Browse latest Browse all 82032

Inline Editor select/select2 update problem in client side

$
0
0

In Editor client side Inline editor mode, I use select2 to fetch the data to update the field named 'good_id',like this

Datatable Columne
{
       title: name'',
       data: 'good_name',
       editField: 'good_id',
       defaultContent: 'please select good'
 }
Editor Field
{
                label: 'name:',
                name: 'good_id',
                type: 'select2',
                optionsPair: {
                    label: 'text',
                    value: 'id'
                },
                display: 'good.name',
                opts: {
                    allowClear: true,
                    dropdownAutoWidth:true,
                     delay:250,
                    ajax: {
                        url: goodUrl,
                        data: function (params) {
                            return {
                                search: params.term
                            }
                        },
                        processResults: function (data, params) {
                            return {
                                results :
                                    data.map(function(item) {
                                        return {
                                            id : item.id,
                                            text : item.name
                                        };
                                    }
                            )};
                        }
                    }
                }
            },

When I select a good, ' id : 1, text: 'aaa', I only can update the good_id field , but I want the good_name can be update as 'aaa', otherwise the td will display white because the good_name doesn't update , So please tell me how should I deal with this problem. All the editor event can only get the the id value not the text.


Viewing all articles
Browse latest Browse all 82032

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>