Ext.namespace('Ext.mainPage.keyWordsResultGrid');

Ext.mainPage.keyWordsResultGrid.renderKeyWordsResultGrid = function(){

  h=document.body.clientHeight-180;
  w=document.body.clientWidth;
  
  var keyWordsResult = new Ext.grid.GridPanel({
    width:213,
    height:h,
    store: Ext.mainPage.keyWordsForm.getObjectsByKeyWordsStore(),
    columns: [{
      id:'name',
      width:180,
      dataIndex:'name',
      sortable:true
      }
    ]
  });

	searchResultsPanel = new Ext.Window({
	  title		    : 'Vysledok vyhladavania',
    applyTo     : 'search_results',
    width       : 230,
    autoHeight  : true,
    closeAction :'hide',
    plain       : true,
	  autoScroll  : true,
	  collapsible : true,
	  x           : w-235,
	  y           : 120,           
	  style: 'float:right',
    items :[keyWordsResult]
  });
  
  function displayObject(t,rowIndex,columnIndex,e){
    objectClickedInGrid=true;
    id=Ext.mainPage.keyWordsForm.getObjectIdByRowIndex(rowIndex);    
    Ext.mainPage.dialogObjectInfo.loadObjectInfoStore(id);
  }
  
  keyWordsResult.addListener('cellclick',displayObject);
}
