Extjs SearchField 애플리케이션

2204 단어
// Search Field  
// <1> JS
<script type="text/javascript" src="/js/Extjs/ux/SearchField.js"></script>

// <2>  SearchField tbar 
var searchField = new Ext.ux.form.SearchField({
                width:140,
                store: store,
                id:'searchField',
                paramName: 'q',
                // Add event
                onTrigger2Click:function(f,e){  // Search button event
                        var v = this.getRawValue();  //  
                        //  -----------------------BEG
                        var filterValue = "[";
                        var rowIndex = keyNameStore.getCount();
                        for(var i=0;i<rowIndex;i++){
                            var record = keyNameStore.getAt(i);
                            var fields = Ext.util.JSON.encode(record.data);
                            var fieldObj = Ext.util.JSON.decode(fields);
                            filterValue += "{keyName:"+"'"+fieldObj.value+"',";
                            filterValue += "logic:"+"'like',";
                            filterValue += "keyValue:"+"'"+v+"',";
                            filterValue += "keyType:"+"'stirng'}";
                            if(i!=(rowIndex-1)){
                              filterValue+= ",";
                            }else{
                              filterValue+= "]";
                            }
                         //  -----------------------END
                        } //for--------END
      //                    
      store.baseParams['filterinfo'] = Ext.util.JSON.encode(Ext.util.JSON.decode(filterValue));
      store.load({ params: { start: 0, limit: pagesize} });
                  } // onTrigger2Click:function ---END
});
//-----------------------------UPD:Select record operation-----------------------END

//  :
//  SearchFiled  onTrigger2Click 
var searchFiledObj = Ext.getCmp('searchField');
searchFiledObj.setRawValue(s_psrName);
searchFiledObj.onTrigger2Click();

좋은 웹페이지 즐겨찾기