Data from an array

raffuk - May 3, 2008 - 11:06
Project:Ajax Table
Version:5.x-1.2
Component:Documentation
Category:support request
Priority:critical
Assigned:raffuk
Status:active
Description

Hello lads,

I loved this module. Its really interesting.

Maybe I've missed something in the documentation, could you please help me ?

I would like to know if its possible to get the data from an array, for example :

Right now in my $table I have ....'query' => 'SELECT id, name, price FROM products WHERE status = 1'

So I have as results :
ID | Name | Price |
1 Watch 12,00

But so far in my project I have made classes and functions to format my results, for example I have a class that check in 4 different tables and bring results in an array.
Is there a way to have an array as a source for the ajaxtable ?

for example this is my array :
Array
(
[0] => Array
(
[id] => 333
[name] => Watch
[price] => 450
[stock] => 10
[average] => 400
)

[1] => Array
(
[id] => 456
[name] => Laptop
[price] => 1500
[stock] => 5
[average] => 1300
)

)
then I would use (If there is any chance) something like this ?
.... 'array' => $products->bestsellers

And have my results as following :
| ID | Name | Price | Stock | Average price |
333 Watch 450 10 400
456 Laptop 1500 5 1300

I hope I made myself clear.

Thank you in advance and congrats once more for the nice work.

- Rafael Vieira

 
 

Drupal is a registered trademark of Dries Buytaert.