3.2.0

Php array not working in Javascript

Ok Heres my problem,

I'm using the Grid control with PHP. Everything was working, but now the grid displays an empty window and I have no idea why.

I have managed to narrow the problem down to the header and cell variables. The do not seem to work with the php functions that create the myHeaders and mycells variable values.

Heres the part of code that is not working,
<script>
var myHeaders = <?php aw_headers($dataset) ?>
var myCells = <?php aw_cells($dataset) ?>
</script>

I have worked this out because if you manually enter the values and the grid works fine.

<script>
var myHeaders = ["Company Name"];
var myCells = [["A1 Moto"]];
</script>

And I know the dataset functions work because if I call the functions inside the php, and display them on the same page, they display the correct data!!

I have changed from Version 2.0 to 2.5, but I have tried using version 2.0 and the same problem persist.

Is it something to do with the opening php statement because it's shown on the forums as

var myHeaders = <?= aw_headers($dataset) ?>
var myCells = <?= aw_cells($dataset) ?>

But when I use <?= this dose not work either!

Help!

Jez
March 8,
Ok... After further debugging it turned out to be a problem with the data from the mysql table. One for the rows had a corrupt column which meant the row was not in a comma separated sequential format, so array failed.

Hey that must catch everyone out, from time to time!


Jez
Jez
March 8,
la solucion que le di a este problema fue cambiar el codigo por este:
var myHeaders = <?php aw_headers($dataset) ?>
var myCells = <?php aw_cells($dataset) ?>
y funciono de maravilla
October 19,
solucione ese detalle cambiando las instrucciones para que quedaran de esta forma:
var myHeaders = <?php aw_headers($dataset) ?>
var myCells = <?php aw_cells($dataset) ?>
Eduardo Mtz
October 19,

This topic is archived.

See also:


Back to support forum