EasyUI Forum
May 20, 2024, 05:48:57 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Combogrid Textfeild  (Read 5814 times)
ftmh
Newbie
*
Posts: 19


View Profile
« on: April 25, 2014, 09:47:37 PM »

hi, i have a big problem, i use a formatter for one of a field in a combogrid to show 'firstName'+'lastName' and load them in combogrid. its work, but for the textfeild  option of combogrid it doesnt work and i can just have one of them fore example : 'firstName' . how can combogrid text become 'firstName'+'lastName'.

thank U  Wink

///////////////////Combogrid Fromatter/////////////////////////////
function ComboFotmatter(param) {
         var cc = $('#cc').combogrid('grid');
         cc.datagrid(function(value, row, index) {
            var NameFamily = row.param.uacUser.firstName + " - "
                  + row.param.uacUser.lastName;
            return [ NameFamily ];
         })
      }




//////////////////////////////////////////////Combogrid////////////////////////////////////////////

<select name="uacUser"  id="cc" class="easyui-combogrid" style="width:250px" data-options="
                                            pagination:true,
                                       panelWidth: 500,
                                       textField:  'firstName',
                                       idField:'id',
                                       url: '<c:url value = '/rest/uac/usersetting/uacuser/list' />',
                                       method: 'get',
                                       columns: [[
                                                   {field:'firstName',title:'firstName',width:80,formatter:UacUserFormatter},
                                                   {field:'personnelCode',title:'personnelCode',width:80,align:'right'},
                                                   {field:'isLocked',title:'isLocked',width:80,align:'right'},

{field:'isEnabled',title:'isEnabled',width:80},
                                                
]],
                                          
fitColumns: true,">
</select>   
Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #1 on: April 26, 2014, 07:45:45 AM »

Please try to use the 'loadFilter' function to generate a new field named 'fullName', which combines 'firstName' and 'lastName' together. Assign this 'fullName' field to the 'textField' property to let it display the full name information.
Code:
<select name="uacUser"  id="cc" class="easyui-combogrid" style="width:250px" data-options="
      pagination:true,
      panelWidth: 500,
      textField:  'fullName',
      idField:'id',
      url: '<c:url value = '/rest/uac/usersetting/uacuser/list' />',
      method: 'get',
      loaderFilter:function(data){
         if ($.isArray(data)){
            data = {total:data.length,rows:data}
         }
         $.map(data.rows, function(row){
            row.fullName = row.firstName+','+row.lastName;
         });
         return data;
      },
      columns: [[
         {field:'firstName',title:'firstName',width:80,formatter:UacUserFormatter},
         {field:'personnelCode',title:'personnelCode',width:80,align:'right'},
         {field:'isLocked',title:'isLocked',width:80,align:'right'},

         {field:'isEnabled',title:'isEnabled',width:80},

      ]],
      fitColumns: true
">
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!