question about Structures_DataGrid

From: Date: Mon, 14 May 2007 12:26:36 +0000
Subject: question about Structures_DataGrid
Groups: php.pear.webmaster 
Request: Send a blank email to pear-webmaster+get-5897@lists.php.net to get a copy of this message
Hi, I am a web programmer from Russia. First of all, excuse my bad english =) I have a question about *Structures_DataGrid* class. I have array in my php programm and I want to generate datagrid with data from that array. I write code: <?php ini_set("include_path", getenv("DOCUMENT_ROOT")."/lib"); require 'Structures/DataGrid.php'; require 'Structures/DataGrid/DataSource/Structures_DataGrid_DataSource_Array.php'; $datagrid = new Structures_DataGrid(); $_result = array(); $_result=array(
    "0"=>array("1987664765756","vagon", "SPb", "11:15", "no"),
"1"=>array("1987664765", "vagon", "SPb", "11:15", "no"), "2"=>array("1987664765789", "vagon", "SPb", "11:15", "no") ); $datasource= new Structures_DataGrid_DataSource_Array(); $datasource->fields=$_result; $datasource->labels=array("number","type","town","time","errors"); $datasource->generate_columns=true; */ $test = $datagrid->bind($_result); if (PEAR::isError($test)) { echo $test->getMessage(); }; $test = $datagrid->render(); if (PEAR::isError($test)) { echo $test->getMessage(); } ?> And I saw error "Unable to determine the data source type. You may want to explicitly specify it." I don't understand where I make a mistake. Please help me and write this example correctly.

« previous php.pear.webmaster (#5897) next »