EasyUI Forum
September 14, 2025, 04:59:40 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: how to make autoconplete in CRUD DataGrid  (Read 7280 times)
htclub
Newbie
*
Posts: 3


View Profile
« on: February 27, 2015, 03:38:05 AM »

I want to make autoconplete input in CRUD DataGrid
how to make?
Logged
htclub
Newbie
*
Posts: 3


View Profile
« Reply #1 on: February 27, 2015, 07:57:08 AM »


can you fix my code
Code:
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>Build CRUD DataGrid with jQuery EasyUI - jQuery EasyUI Demo</title>
    <link rel="stylesheet" type="text/css" href="css/easyui.css">
    <link rel="stylesheet" type="text/css" href="css/icon.css">
    <link rel="stylesheet" type="text/css" href="css/demo.css">
    <script type="text/javascript" src="js/jquery-1.6.min.js"></script>
    <script type="text/javascript" src="js/jquery.easyui.min.js"></script>
    <script type="text/javascript" src="js/jquery.edatagrid.js"></script>
</head>
<body>
    <h2>CRUD DataGrid</h2>
    <p>Double click the row to begin editing.</p>
   
    <table id="dg" title="My Users" style="width:100%;height:400"
            toolbar="#toolbar" pagination="false" idField="id"
            rownumbers="true" fitColumns="true" singleSelect="true">
        <thead>
            <tr>
                <th field="firstname" width="50" editor="{type:'validatebox',options:{required:true}}">First Name</th>
                <th field="lastname" width="50" editor="{type:'validatebox',options:{required:true}}">Last Name</th>
                <th field="phone" width="50" editor="text">Phone</th>
                <th field="email" width="50" editor="{type:'validatebox',options:{validType:'number'}}">Email</th>
            </tr>
        </thead>
    </table>
    <div id="toolbar">
        <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-add" plain="true" onclick="javascript:$('#dg').edatagrid('addRow')">New</a>
        <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-remove" plain="true" onclick="javascript:$('#dg').edatagrid('destroyRow')">Destroy</a>
        <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-save" plain="true" onclick="javascript:$('#dg').edatagrid('saveRow')">Save</a>
        <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-undo" plain="true" onclick="javascript:$('#dg').edatagrid('cancelRow')">Cancel</a>
    </div>
    <script type="text/javascript">
        $(function(){
            $('#dg').edatagrid({
destroyMsg:{
norecord:{
title:'Cảnh baos',
msg:'Chưa chonj bản ghi.'
},
confirm:{
title:'Xác nhân',
msg:'Bạn cos muoons xoá khong?'
}
},
onBeginEdit: function(rows,r){
$('.datagrid-editable-input').combogrid({
delay: 500,
panelWidth:650,
mode: 'remote',
url: 'datagrid_data1.json',
idField: 'productid',
textField: 'productname',
columns: [[
{field:'productid',title:'Code',width:120,sortable:true},
{field:'productname',title:'Name',width:400,sortable:true}
]]
});
},
editIndex: 20,
autoSave: true, // auto save the editing row when click out of datagrid
                url: 't/get_users.php',
                saveUrl: 't/save_user.php',
                updateUrl: 't/update_user.php',
                destroyUrl: 't/destroy_user.php'
            });
        });

    </script>

</body>
</html>
Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #2 on: February 28, 2015, 12:36:05 AM »

Please set the 'combogrid' editor instead of 'text' editor for your column.
Code:
<th field="phone" width="50" data-options="
editor:{
type:'combogrid',
options:{
delay: 500,
panelWidth:650,
mode: 'remote',
url: 'datagrid_data1.json',
idField: 'productid',
textField: 'productname',
columns: [[
{field:'productid',title:'Code',width:120,sortable:true},
{field:'productname',title:'Name',width:400,sortable:true}
]]
}
}
">Phone</th>
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!