<?php 
	include_once("_dirinfo.php");
	include_once(PATH_TO_ROOT."init.php");
	include_once(PATH_TO_ROOT."/_support/repository.php");
	// javascript files
	$_repository[GridTree][js][] = "_plugins/GridTree/TreeGrid.packed.js";

	// CSS styles
	$_repository[GridTree][css][] = "_plugins/GridTree/css/TreeGrid.css";
	$_repository[GridTree][css][] = "_plugins/GridTree/css/TreeGridLevels.css";
	
	loadPlugin($_repository ,'GridTree' );
	
?>
	
	var blaTest = new Ext.grid.CheckColumn({
	header: "Change", width: 75, sortable: true,  dataIndex: 'is_project'
	});
	
    // create the data store
    var record = Ext.data.Record.create([
   		{name: 'id'},
     	{name: 'idLab'},
     	{name: 'is_project', type: 'float'},
     	{name: '_id', type: 'int'},
     	{name: '_parent', type: 'auto'},
     	{name: '_is_leaf', type: 'bool'}
   	]);
    var store = new Ext.ux.maximgb.tg.AdjacencyListStore({
    	autoLoad : true,
    	url: '_forms/_ajax/ajax.treeGrid.php',
		reader: new Ext.data.JsonReader(
				{
					id: '_id',
					root: 'rows',
					totalProperty: 'total',
					successProperty: 'success'
				}, 
				record
			),
		baseParams:{action:'select'}
    });
    // create the Grid
    var grid = new Ext.ux.maximgb.tg.EditorGridPanel({
      store: store,
      master_column_id : 'burek',
      columns: [
				{id:'burek',header: "Company", width: 160, sortable: true, dataIndex: 'id'},
        {id:'idLab',header: "Price", width: 75, sortable: true,  dataIndex: 'idLab',editor:new Ext.form.TextField()},
       blaTest
      ],
      autoExpandColumn: 'idLab',
      title: 'Adjacency list server grid.',
      stripeRows:true,
      plugins:[blaTest],
      bbar: new Ext.ux.maximgb.tg.PagingToolbar({
      	store: store,
      	displayInfo: true,
      	pageSize: 10
      })
    });
   // grid.getSelectionModel().selectFirstRow();
	
	mainTabPanel.add(grid);


