EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: creazyboy on July 04, 2014, 01:02:55 AM



Title: How to change editor type dynamically according to some conditions
Post by: creazyboy on July 04, 2014, 01:02:55 AM
How to change editor type dynamically  according to some conditions!

The attachment is the screenshot!

Code as follows:

<div id="southDe" class="southDe">
<table id="dg"  class="easyui-datagrid" title=""
         data-options="
            width:450,
            height:330,
            top:0,
            singleSelect:true,
            url: '../ajax?sid='+threadSID+'&cmd=PCPM_GET_FILERTDETAIL&fuuid='+fUUID,
            method: 'post',
            hideColumn:'UUID',
            toolbar:[{
               text:'新建',
               iconCls:'icon-add',
               handler:function(){appendFilterDetail();}
            },'-',{
               text:'删除',
               iconCls:'icon-remove',
               handler:function(){removeFilterDetail();}
            },'-',{
               text:'保存',
               iconCls:'icon-save',
               handler:function(){sureFilterDetail();}
            },'-',{
               text:'取消',
               iconCls:'icon-undo',
               handler:function(){cancelFilterDetail();}
            }]
            ">
      <thead>
         <tr>
            <th data-options="field:'LOGIC',width:60,halign:'center',align:'center',editor:'text',formatter:function(value,row){return formatLogic(value,row);}">逻辑</th>
            <th data-options="field:'FIELD',width:80,align:'center',editor:'text',formatter:function(value,row){return formatField(value,row);},editor:{type:'combobox',options:{url:'../ajax?sid='+threadSID+'&cmd=PCPM_GET_FIELDS&id=&type='+type,valueField:'id',textField:'name',method:'post',required:true,onSelect:function(row){formatFieldType(row);}}}">参数</th>
            <th data-options="field:'CONDITION',width:100,align:'center',editor:'text',formatter:function(value,row){return formatCondition(value,row);},editor:{type:'combobox', options: { data: condition, valueField:'id',textField:'text',method:'post',required:true,onSelect:function(row){formatMaxValueEditor(row,this);}}}">条件</th>
            <th data-options="field:'VALUE',width:80,align:'center',editor:{type:'text'}">值</th>
            <th data-options="field:'MAXVALUE',width:80,align:'center',editor:'text'">最大值</th>
            <th data-options="field:'UUID',width:10,align:'center',hidden:true,editor:'text'">过滤器详情编码</th>
         </tr>
      </thead>
</table>

When the datagrid in the editing status, I  want to change the editor type of 'VALUE' according  to 'FIELD' ! For examples, when the type of field selected is date, the editor type of 'VALUE'  maybe datebox,when the type of field selected is dictionary, the editor type of 'VALUE'  maybe combobox,How to  achieve to this goal!

Thanks very very much!


Title: Re: How to change editor type dynamically according to some conditions
Post by: zurfero on September 12, 2014, 09:10:20 AM
I have interested in your question..., I have the same issue..., but not find a solution yet.
Anybody can help us??
Is possible change editor dinamically???


Title: Re: How to change editor type dynamically according to some conditions
Post by: A-K on September 12, 2014, 12:52:59 PM
Hey, maybe this thread I opened not long ago will help you. Its very similar.

http://www.jeasyui.com/forum/index.php?topic=3703.msg8525#msg8525 (http://www.jeasyui.com/forum/index.php?topic=3703.msg8525#msg8525)


Title: Re: How to change editor type dynamically according to some conditions
Post by: zurfero on September 14, 2014, 11:09:12 PM
A-K, your answer it's 100% OK and solve the question..., THANK YOU VERY MUCH!!