hai, i'm trying to get the grid working with php/mysql, but when i select a db, table and some fields.. it wont show anything..
i double checked my sql info is right..
this is the source in html when i open basic.php
<html>
<head>
<title>ActiveWidgets Grid :: PHP Example</title>
<style> body, html {margin:0px; padding: 0px; overflow: hidden;font: menu;border: none;} </style>
<link href="../../runtime/styles/xp/grid.css" rel="stylesheet" type="text/css" ></link>
<script src="../../runtime/lib/grid.js"></script>
</head>
<body>
<script>
var _columns = [
];
var _data = [
];
try {
var = new Active.Controls.Grid;
.setRowCount();
.setColumnCount();
.setDataText(function(i, j){return _data[i][j]});
.setColumnText(function(i){return _columns[i]});
document.write();
}
catch (error){
document.write(error.description);
}
</script>
</body>
</html>
anyone knows how 2 solve this?
There isn't any data in this code. It can't display what isn't there. You are making an error in your PHP code, otherwise there would be information between your "var _data = [ " and your "];".
Post the PHP code and we might be able to assist you. But from what you have posted above, the grid is working properly.
ok, the main problem is solved.. i dont know what it was, but i uploaded it today and it works! great stuff!
It seems to be i cant select the fields that will be added to the grid, because every field is showing up now:S. this is my script:
<html>
<head>
<title>ActiveWidgets Grid :: PHP Example</title>
<style> body, html {margin:0px; padding: 0px; overflow: hidden;font: menu;border: none;} </style>
<link href="../../runtime/styles/xp/grid.css" rel="stylesheet" type="text/css" ></link>
<script src="../../runtime/lib/grid.js"></script>
<?php include("activewidgets.php") ?>
<?php include("config.php") ?>
</head>
<body>
<?php
$name = "obj";
$query = "select * from `leden` limit 0,20";
$connection = mysql_connect("$host", "$user", "$ww");
mysql_select_db("$db");
$data = mysql_query($query, $connection);
echo activewidgets_grid($gebruikersnaam, $automerk, $type);
?>
</body>
</html>
how can i only select $gebruikersnaam, $automerk and $type?
i have attached my coding in this. here is an error. that is array is undefined. any one can solve this pbm?
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"
http://www.w3.org/tr/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<style>
html {background-color:#eeeeee}
body {
background-color:#ffffcc;
font-family:Tahoma,Arial,Helvetica,sans-serif;
font-size:12px;
margin-left:15%;
margin-right:15%;
border:3px groove #006600;
padding:15px
}
h1 {
text-align:left;
font-size:1.5em;
font-weight:bold
}
</style>
<script type="text/javascript">
// global flag
var isIE = false;
// global request and XML document objects
var req;
//document.getElementById("hiddenDIV").style.visibility="visible";
//document.getElementById("hiddenDIV").innerHTML=xhr.rs(0);
function loadXMLDoc(url) {
// branch for native XMLHttpRequest object
if (window.XMLHttpRequest) {
req = new XMLHttpRequest();
req.onreadystatechange = processReqChange;
req.open("GET", url, true);
req.send(null);
// branch for IE/Windows ActiveX version
} else if (window.ActiveXObject) {
isIE = true;
req = new ActiveXObject("Microsoft.XMLHTTP");
if (req) {
req.onreadystatechange = processReqChange;
req.open("GET", url, true);
req.send();
}
}
}
function loadDoc(evt) {
// equalize W3C/IE event models to get event object
evt = (evt) ? evt : ((window.event) ? window.event : null);
if (evt) {
// equalize W3C/IE models to get event target reference
var elem = (evt.target) ? evt.target : ((evt.srcElement) ? evt.srcElement : null);
if (elem) {
try {
if (elem.selectedIndex > 0) {
loadXMLDoc(elem.options[elem.selectedIndex].value);
}
}
catch(e) {
var msg = (typeof e == "string") ? e : ((e.message) ? e.message : "Unknown Error");
alert("Unable to get XML data:\n" + msg);
return;
}
}
}
}
// retrieve text of an XML document element, including
// elements using namespaces
function getElementTextNS(prefix, local, parentElem, index) {
var result = "";
if (prefix && isIE) {
// IE/Windows way of handling namespaces
result = parentElem.getElementsByTagName(prefix + ":" + local)[index];
} else {
// the namespace versions of this method
// (getElementsByTagNameNS()) operate
// differently in Safari and Mozilla, but both
// return value with just local name, provided
// there aren't conflicts with non-namespace element
// names
result = parentElem.getElementsByTagName(local)[index];
}
if (result) {
// get text, accounting for possible
// whitespace (carriage return) text nodes
if (result.childNodes.length > 1) {
return result.childNodes[1].nodeValue;
} else {
return result.firstChild.nodeValue;
}
} else {
return "n/a";
}
}
// display details retrieved from XML document
function showDetail(evt) {
evt = (evt) ? evt : ((window.event) ? window.event : null);
var item, content, div;
if (evt) {
var select = (evt.target) ? evt.target : ((evt.srcElement) ? evt.srcElement : null);
if (select && select.options.length > 1) {
// copy <content:encoded> element text for
// the selected item
item = req.responseXML.getElementsByTagName("item")[select.value];
content = getElementTextNS("content", "encoded", item, 0);
div = document.getElementById("details");
div.innerHTML = "";
// blast new HTML content into "details" <div>
div.innerHTML = content;
}
}
}
//for retrieving data
function ConDB()
{
var s1 = document.fm.t1.value;
var nm = s1.substring(0,2);
var n1 = null;
if (nm.length >= 2)
{
var conn = new ActiveXObject("ADODB.Connection") ;
var connectionstring="Provider=SQLOLEDB;Password=sa;User ID=sa;Initial Catalog=TEST;Data Source=192.168.1.83;"
conn.Open(connectionstring);
var rs = new ActiveXObject("ADODB.Recordset");
var recordarray=new array();
var i=0;
rs.Open("SELECT * FROM STUD WHERE NAME LIKE '%" + nm + "%'", conn);
if (!rs.eof && !rs.bof)
{
rs.moveFirst
while(!rs.eof)
{
// var oOption = document.createElement("OPTION");
// oSelect.options.add(oOption);
// oOption.innerText = rs(0);
recordarray[i]=rs(0);
i+=1;
rs.moveNext
}
}
else
{
document.write('No matches found!');
}
rs.close;
conn.close;
}
else
{
document.write(" plz enter more than one char");
}
}
</script>
</head>
<body>
<h1><b><center>Search Engine</center></b></h1>
<hr />
<form name="fm">
<p><center>Enter the string to search</center><br />
<center><input type="text" name="t1" value="" onkeyup="ConDB();"></center>
</p>
<p>Items:<br />
<select size="10" id="topics" onchange="showDetail(event)">
<option value="">output of search details</option>
</select>
</p>
</form>
<div size="10" id="details"><span></span></div>
</body>
</html>
This topic is archived.