ajem70
5 Jun 2007, 1:37 PM
This is my html file
<html>
<head>
<title>Metadata</title>
<link rel="stylesheet" type="text/css" href="../../resources/css/ext-all.css"/>
<link rel="stylesheet" type="text/css" href="../examples.css" />
<!-- GC -->
<!-- LIBS -->
<script type="text/javascript" src="../../adapter/yui/yui-utilities.js"></script>
<script type="text/javascript" src="../../adapter/yui/ext-yui-adapter.js"></script>
<script type="text/javascript" src="../../ext-all.js"></script>
<!-- ENDLIBS -->
<script type="text/javascript" src="../examples.js"></script>
<script type="text/javascript" src="layout.js"></script>
<script type="text/javascript" src="gridtabelas_page2.js"></script>
<style>
.x-layout-panel-north{
border:0px none;
background:#0000aa url(../../resources/images/default/basic-dialog/hd-sprite.gif) repeat-x 0px -83px;
padding-top:3px;
padding-left:3px;
font-family: Tahoma, Verdana, Arial, Helvetica, sans-serif;
font-size: 1.2em;
color:white;
}
.scroll-bottom .x-btn-text {
background-image: url(new_window.gif);
}
.scroll-top .x-btn-text {
background-image: url(new_window.gif);
}
.x-layout-collapsed-west {
/*background-image:url(navigation.gif);*/
background-repeat:no-repeat;
background-position:center;
}
</style>
</head>
<body>
<div id="north-div"></div>
<div id="south-div"></div>
<div id="east-div"></div>
<div id="west-div">
<div id="gridtabelas" class="x-grid-mso" style="border: 1px solid #c3daf9; overflow: hidden; width:400px;"></div>
</div>
<div id="center-div">
<div id="center-tb"></div>
<div id="gridtabelacolunas" class="x-grid-mso" style="border: 1px solid #c3daf9; overflow: hidden; width:100%; top:0px; left:0px;"></div>
</div>
</body>
</html>
this is my js file :
Ext.onReady(function(){
// create the Data Store
var ds = new Ext.data.Store({
// load using HTTP
proxy: new Ext.data.HttpProxy({url: 'tabelacolunas.php'}),
// the return will be XML, so lets set up a reader
reader: new Ext.data.XmlReader({
// records will have an "Item" tag
record: 'row',
id: 'ColumnTable_ID',
totalRecords: '@total'
}, [
// set up the fields mapping into the xml doc
// The first needs mapping, the others are very basic
'ColumnTable_ID','ColumnName','Description','UsageDesc','DataType','SizeCol','PrecisionCol','KeyType','FK_To','IsNull','DefaultValue','UnknownMember','ExempleValues','ExempleValuesURL','SCDType','SourceSystem','SourceTable','SourceSchema','SourceFieldName','SourceDatatype','ETLRules','Comments','DocumentsURL','IsHierarchyMember','IsAtributeMember','IsMemberCalculate','IsOnlyInClube','CubeFormula'
])
});
// now we create the Grid Columns
var sm = new Ext.grid.RowSelectionModel({singleSelect:true});
var cm = new Ext.grid.ColumnModel([
{header: "ID", width: 40, dataIndex: 'ColumnTable_ID'},
{header: "Name", width: 100, dataIndex: 'ColumnName'},
{header: "Description", width: 120, dataIndex: 'Description'},
{header: "UsageDesc", width: 120, dataIndex: 'UsageDesc'}
]);
cm.defaultSortable = true;
// create the grid
var grid = new Ext.grid.Grid('gridtabelacolunas', {
ds: ds,
cm: cm,
selModel: sm
});
grid.render();
var gridFoot = grid.getView().getFooterPanel(true);
// add a paging toolbar to the grid's footer
var paging = new Ext.PagingToolbar(gridFoot, ds, {
pageSize: 15,
displayInfo: true,
displayMsg: 'Displaying topics {0} - {1} of {2}',
emptyMsg: "No topics to display"
});
ds.load({params:{'start':0, 'limit':15, 'Table_ID':2}});
});
my php code:
<?php require_once('../../Connections/conn.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
// Query the database and get all the records from the Images table
$colname_rsAll = "-1";
if (isset($_GET['Table_ID'])) {
$colname_rsAll = $_GET['Table_ID'];
}
$inicio_rsAll = "-1";
if (isset($_GET['start'])) {
$inicio_rsAll = $_GET['start'];
}
$limite_rsAll = "-1";
if (isset($_GET['limit'])) {
$limite_rsAll = $_GET['limit'];
}
mysql_select_db($database_conn, $conn);
$query_rsAll = sprintf("SELECT m.ColumnTable_ID, m.Table_ID, m.ColumnName, m.Description, m.UsageDesc, m.DataType, m.SizeCol, m.PrecisionCol, m.KeyType, m.FK_To, m.IsNull, m.DefaultValue, m.UnknownMember, m.ExempleValues, m.ExempleValuesURL, m.SCDType, m.SourceSystem, m.SourceTable, m.SourceSchema, m.SourceFieldName, m.SourceDatatype, m.ETLRules, m.Comments, m.DocumentsURL, m.IsHierarchyMember, m.IsAtributeMember, m.IsMemberCalculate, m.IsOnlyInClube, m.CubeFormula FROM mdtablecolumns m WHERE m.Table_ID = %s LIMIT %s,%s", GetSQLValueString($colname_rsAll, "int"),GetSQLValueString($inicio_rsAll, "int"),GetSQLValueString($limite_rsAll, "int"));
$rsAll = mysql_query($query_rsAll, $conn) or die(mysql_error());
$row_rsAll = mysql_fetch_assoc($rsAll);
$totalRows_rsAll = mysql_num_rows($rsAll);
// Send the headers
header('Content-type: text/xml');
header('Pragma: public');
header('Cache-control: private');
header('Expires: -1');
?>
<?php echo('<?xml version="1.0" encoding="utf-8"?>'); ?>
<root>
<?php if ($totalRows_rsAll > 0) { // Show if recordset not empty ?>
<?php do { ?>
<row>
<?php foreach ($row_rsAll as $column=>$value) { ?>
<<?php echo $column; ?>><![CDATA[<?php echo $row_rsAll[$column]; ?>]]></<?php echo $column; ?>>
<?php } ?>
</row>
<?php } while ($row_rsAll = mysql_fetch_assoc($rsAll)); ?>
<?php } // Show if recordset not empty ?>
</root>
<?php
mysql_free_result($rsAll);
?>
i did a test without params and work, with parameters i don't have records, the xml return is valid you can check it with the file xml.txt
I'm loosing hours trying to analyze this.
Every help is welcome.
Thank you in advance.
Ant
<html>
<head>
<title>Metadata</title>
<link rel="stylesheet" type="text/css" href="../../resources/css/ext-all.css"/>
<link rel="stylesheet" type="text/css" href="../examples.css" />
<!-- GC -->
<!-- LIBS -->
<script type="text/javascript" src="../../adapter/yui/yui-utilities.js"></script>
<script type="text/javascript" src="../../adapter/yui/ext-yui-adapter.js"></script>
<script type="text/javascript" src="../../ext-all.js"></script>
<!-- ENDLIBS -->
<script type="text/javascript" src="../examples.js"></script>
<script type="text/javascript" src="layout.js"></script>
<script type="text/javascript" src="gridtabelas_page2.js"></script>
<style>
.x-layout-panel-north{
border:0px none;
background:#0000aa url(../../resources/images/default/basic-dialog/hd-sprite.gif) repeat-x 0px -83px;
padding-top:3px;
padding-left:3px;
font-family: Tahoma, Verdana, Arial, Helvetica, sans-serif;
font-size: 1.2em;
color:white;
}
.scroll-bottom .x-btn-text {
background-image: url(new_window.gif);
}
.scroll-top .x-btn-text {
background-image: url(new_window.gif);
}
.x-layout-collapsed-west {
/*background-image:url(navigation.gif);*/
background-repeat:no-repeat;
background-position:center;
}
</style>
</head>
<body>
<div id="north-div"></div>
<div id="south-div"></div>
<div id="east-div"></div>
<div id="west-div">
<div id="gridtabelas" class="x-grid-mso" style="border: 1px solid #c3daf9; overflow: hidden; width:400px;"></div>
</div>
<div id="center-div">
<div id="center-tb"></div>
<div id="gridtabelacolunas" class="x-grid-mso" style="border: 1px solid #c3daf9; overflow: hidden; width:100%; top:0px; left:0px;"></div>
</div>
</body>
</html>
this is my js file :
Ext.onReady(function(){
// create the Data Store
var ds = new Ext.data.Store({
// load using HTTP
proxy: new Ext.data.HttpProxy({url: 'tabelacolunas.php'}),
// the return will be XML, so lets set up a reader
reader: new Ext.data.XmlReader({
// records will have an "Item" tag
record: 'row',
id: 'ColumnTable_ID',
totalRecords: '@total'
}, [
// set up the fields mapping into the xml doc
// The first needs mapping, the others are very basic
'ColumnTable_ID','ColumnName','Description','UsageDesc','DataType','SizeCol','PrecisionCol','KeyType','FK_To','IsNull','DefaultValue','UnknownMember','ExempleValues','ExempleValuesURL','SCDType','SourceSystem','SourceTable','SourceSchema','SourceFieldName','SourceDatatype','ETLRules','Comments','DocumentsURL','IsHierarchyMember','IsAtributeMember','IsMemberCalculate','IsOnlyInClube','CubeFormula'
])
});
// now we create the Grid Columns
var sm = new Ext.grid.RowSelectionModel({singleSelect:true});
var cm = new Ext.grid.ColumnModel([
{header: "ID", width: 40, dataIndex: 'ColumnTable_ID'},
{header: "Name", width: 100, dataIndex: 'ColumnName'},
{header: "Description", width: 120, dataIndex: 'Description'},
{header: "UsageDesc", width: 120, dataIndex: 'UsageDesc'}
]);
cm.defaultSortable = true;
// create the grid
var grid = new Ext.grid.Grid('gridtabelacolunas', {
ds: ds,
cm: cm,
selModel: sm
});
grid.render();
var gridFoot = grid.getView().getFooterPanel(true);
// add a paging toolbar to the grid's footer
var paging = new Ext.PagingToolbar(gridFoot, ds, {
pageSize: 15,
displayInfo: true,
displayMsg: 'Displaying topics {0} - {1} of {2}',
emptyMsg: "No topics to display"
});
ds.load({params:{'start':0, 'limit':15, 'Table_ID':2}});
});
my php code:
<?php require_once('../../Connections/conn.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
// Query the database and get all the records from the Images table
$colname_rsAll = "-1";
if (isset($_GET['Table_ID'])) {
$colname_rsAll = $_GET['Table_ID'];
}
$inicio_rsAll = "-1";
if (isset($_GET['start'])) {
$inicio_rsAll = $_GET['start'];
}
$limite_rsAll = "-1";
if (isset($_GET['limit'])) {
$limite_rsAll = $_GET['limit'];
}
mysql_select_db($database_conn, $conn);
$query_rsAll = sprintf("SELECT m.ColumnTable_ID, m.Table_ID, m.ColumnName, m.Description, m.UsageDesc, m.DataType, m.SizeCol, m.PrecisionCol, m.KeyType, m.FK_To, m.IsNull, m.DefaultValue, m.UnknownMember, m.ExempleValues, m.ExempleValuesURL, m.SCDType, m.SourceSystem, m.SourceTable, m.SourceSchema, m.SourceFieldName, m.SourceDatatype, m.ETLRules, m.Comments, m.DocumentsURL, m.IsHierarchyMember, m.IsAtributeMember, m.IsMemberCalculate, m.IsOnlyInClube, m.CubeFormula FROM mdtablecolumns m WHERE m.Table_ID = %s LIMIT %s,%s", GetSQLValueString($colname_rsAll, "int"),GetSQLValueString($inicio_rsAll, "int"),GetSQLValueString($limite_rsAll, "int"));
$rsAll = mysql_query($query_rsAll, $conn) or die(mysql_error());
$row_rsAll = mysql_fetch_assoc($rsAll);
$totalRows_rsAll = mysql_num_rows($rsAll);
// Send the headers
header('Content-type: text/xml');
header('Pragma: public');
header('Cache-control: private');
header('Expires: -1');
?>
<?php echo('<?xml version="1.0" encoding="utf-8"?>'); ?>
<root>
<?php if ($totalRows_rsAll > 0) { // Show if recordset not empty ?>
<?php do { ?>
<row>
<?php foreach ($row_rsAll as $column=>$value) { ?>
<<?php echo $column; ?>><![CDATA[<?php echo $row_rsAll[$column]; ?>]]></<?php echo $column; ?>>
<?php } ?>
</row>
<?php } while ($row_rsAll = mysql_fetch_assoc($rsAll)); ?>
<?php } // Show if recordset not empty ?>
</root>
<?php
mysql_free_result($rsAll);
?>
i did a test without params and work, with parameters i don't have records, the xml return is valid you can check it with the file xml.txt
I'm loosing hours trying to analyze this.
Every help is welcome.
Thank you in advance.
Ant