日期:2014-05-16  浏览次数:20866 次

初学Extjs问题?TBar中的tooltip显示不出来?
为什么tooltip无效,显示不出来?没搞明白!呵呵,请大家指点下?

Ext.onReady(function(){

  // create the Data Store
  var store = new Ext.data.JsonStore({
  root: 'Products',
  totalProperty: 'totalCount',
  idProperty: 'ProductID',
  remoteSort: true,
//sortInfo:{field: 'ProductID', direction: 'ASC'}  
  fields: [
  {name: 'ProductID', type: 'int'} , 'ProductName', 'QuantityPerUnit'
  ],

  // load using script tags for cross domain, if the data in on the same domain as
  // this page, an HttpProxy would be better
  proxy: new Ext.data.HttpProxy({
  //url: 'http://extjs.com/forum/topics-browse-remote.php'  
  url: 'http://localhost/Asp/ext-3.2.1/MyTools/HttpProxy/GetNorth.asp'
  })
  });
   

  store.setDefaultSort('ProductID', 'asc');


  // pluggable renders
  function renderTopic(value, p, record){
  return String.format(
  '<b><a href="http://extjs.com/forum/showthread.php?t={2}" target="_blank">{0}</a></b><a href="http://extjs.com/forum/forumdisplay.php?f={3}" target="_blank">{1} Forum</a>',
  value, record.data.forumtitle, record.id, record.data.forumid);
  }
  function renderLast(value, p, r){
  return String.format('{0}<br/>by {1}', value.dateFormat('M j, Y, g:i a'), r.data['lastposter']);
  }


var sm2 = new Ext.grid.CheckboxSelectionModel({
  listeners: {
  // On selection change, set enabled state of the removeButton
  // which was placed into the GridPanel using the ref config
  selectionchange: function(sm) {
  if (sm.getCount()) {
  grid.removeButton.enable();
  } else {
  grid.removeButton.disable();
  }
  }
  }
  });


  var grid = new Ext.grid.GridPanel({

  // inline toolbars
  tbar:[{
  text:'新增',
  tooltip:'新增记录',
  iconCls:'add'
  }, '-', {
  text:'修改',
  tooltip:'修改记录',
  iconCls:'option'
  },'-',{
  text:'删除',
  tooltip:'删除记录',
  iconCls:'remove',

  // Place a reference in the GridPanel
  ref: '../removeButton',
  disabled: true  
  },'-',{
  xtype:'textfield',
  id:'KeyWord',
  width:100,
  title:'请输入关键词'
  },'-',{
  xtype:'combo',
  store: store,  
  fieldLabel: '请选择分类',  
  valueField :"ProductID",  
  displayField: "ProductID",  
  mode: 'local',  
  forceSelection: true,//必须选择一项  
  emptyText:'请选择分类',//默认值  
  hiddenName:'ProductID',//hiddenName才是提交到后台的input的name  
  editable: false,//不允许输入  
  triggerAction: 'all',//因为这个下拉是只能选择的,所以一定要设置属性triggerAction