Welcome Guest, Not a member yet? Register   Sign In
Anyone using LiveGrid with CI
#1

[eluser]geshan[/eluser]
Constructing a datagrid with pagination I stumbled upon LiveGrid (http://www.chrisvandesteeg.nl/2005/07/25/livegrid/) its is a good component that gives rise to pagination less grid (like your mails in Yahoo mail). So I tried to use it but it needs a JSON object to work (I'm not familiar with JSON) and the implementation complex.If anyone has used it with CI please help me. Your help will be appreciated.

Thanks in Advance.
#2

[eluser]vlad_ci[/eluser]
I did not use that grid, but I am using dojo Javascript library
and they have many components that use JSON objects
as their data structures to store/retreive data for a given
control (component).

Basically the grid somewhere will tell you:
' provide a URL from which I can receive a JSON object'

and then the grid documentation will also tell you
the format of that JSON object.

So all you do in CI,
is support (with your Controller) a URL that would return
back a JSON string.

JSON string is nothing more than a 'textual' representation
of a multi dimensional array.

So, say you have in your controller method supporting
the URL specified in the grid:

Code:
function send_back_json ()
{
$final_array=array("column_nm_A"=>25,
                    "column_nm_B"=>'who is it?');
echo header("Content-Type: application/json");
echo json_encode($final_array);
}


and that's it as far as PHP5/CI/JSON.


Now, to be CI-compliant you might want to move the
code of echoing stuff into CI's view thing.
Advantage of doing via view -- is that apparently you can
cache the JSON so if your JSON does not change often,
it can be cached with CI's caching functionality (but I have
not tried that yet ... )

hope this helps










[quote author="geshan" date="1221042754"]Constructing a datagrid with pagination I stumbled upon LiveGrid (http://www.chrisvandesteeg.nl/2005/07/25/livegrid/) its is a good component that gives rise to pagination less grid (like your mails in Yahoo mail). So I tried to use it but it needs a JSON object to work (I'm not familiar with JSON) and the implementation complex.If anyone has used it with CI please help me. Your help will be appreciated.

Thanks in Advance.[/quote]
#3

[eluser]geshan[/eluser]
I encoded it to JSON the response is all right but just get blank rows in live grid. So I tried to use Rico Live grid with PHP example looking at this http://forum.openrico.org/topic/233 there was pdf but again things seem ok, Response is not as desired and there are blank rows. Need a solution badly.
#4

[eluser]vlad_ci[/eluser]
The only thing I can suggest is

to create a test JSON structure right within your
Javascript code, then feed that into the grid
and get that to work. If that does not work,
the issue is not in PHP

Once you got that to work, execute an asyncronious
javascript call to PHP, and from PHP output the same
exact test structure. And if if that does not work,
it would most likely mean that there is a problem
in how you interpreting the Async response back in your
javascript code.


I can tell you that PHP's 5.2 json_encode function
works perfectly fine for encoding PHP arrays into
valid JSON structures -- even if the data contains
non-ascii characters or quotes within strings.
#5

[eluser]geshan[/eluser]
Thank you I"m getting some results with RICO grid but still its hard to integrate to a data gird Library. The balance to make is a hard one.




Theme © iAndrew 2016 - Forum software by © MyBB