yajra / laravel-datatables-editor

Laravel DataTables Editor Integration.
https://yajrabox.com/docs/laravel-datatables/editor-installation
MIT License
114 stars 15 forks source link

How to set selected option when edit record #18

Closed vanthao03596 closed 6 years ago

vanthao03596 commented 6 years ago

Summary of problem or feature request

I'm using laravel-datatables-editor package to edit record with modal. But when i edit record, field of type select is not select same value in datatabase. Need some helps please, Thanks!.

Code snippet of problem

var editor = new $.fn.dataTable.Editor({ ajax: '/admin/users', table: '#users', display: 'bootstrap', idSrc: 'id', fields: [ { label: 'Tên:', name: 'name' }, { label: 'Địa chỉ email:', name: 'email' }, { label: 'Trạng thái:', name: 'is_active', type: 'select', options: [ { label: 'Hoạt động', value: 1 }, { label: 'Ngưng hoạt động', value: 0 } ], def: 1 }, { label: 'Số điện thoại:', name: 'phone_number' }, { label: 'Mật khẩu:', name: 'password', type: 'password' } ], i18n: { create: { button: 'Thêm', title: 'Thêm mới người dùng', submit: 'Lưu lại' } } });

System details