Bind data from a subscription to a jquery grid

Apr 7, 2011 at 11:55 AM
Edited May 5, 2011 at 4:59 PM


is it possible to bind recieved data from a subscription to a jquery grid such as flexgrid:

How can i do this?

Here is a sample code from the flexgrid website:

url: 'post2.php',
dataType: 'json',
colModel : [
{display: 'ISO', name : 'iso', width : 40, sortable : true, align: 'center'},
{display: 'Name', name : 'name', width : 180, sortable : true, align: 'left'},
{display: 'Printable Name', name : 'printable_name', width : 120, sortable : true, align: 'left'},
{display: 'ISO3', name : 'iso3', width : 130, sortable : true, align: 'left', hide: true},
{display: 'Number Code', name : 'numcode', width : 80, sortable : true, align: 'right'}
buttons : [
{name: 'Add', bclass: 'add', onpress : test},
{name: 'Delete', bclass: 'delete', onpress : test},
{separator: true}
searchitems : [
{display: 'ISO', name : 'iso'},
{display: 'Name', name : 'name', isdefault: true}
sortname: "iso",
sortorder: "asc",
usepager: true,
singleSelect: true,
title: 'Countries',
useRp: true,
rp: 15,
showTableToggleBtn: true,
width: 700,
height: 200

What sould i write for the url parameter and the datatype? 
Is it also JSON?
Thank you for your help
Apr 8, 2011 at 7:35 AM
Edited Apr 8, 2011 at 7:36 AM

Laharsub is agnostic to the data format of the messages published to the system, and so it can be used to exchange JSON or XML messages among other formats. Looking at the flexgrid examples on the page, I don't think you would be able to integrate flexgrid with laharsub using the 'url' parameter in the example above, since flexgrid will not understand the protocol used by laharsub. It appears however that you can apply flexgrid styling to an HTML element pre-populated with data, which gives you an opportunity to use laharsub subscription to update the content of an HTML element on the page with data received from the laharsub server, and then apply flexgrid styling over it.

May 5, 2011 at 4:58 PM
Edited May 5, 2011 at 5:00 PM

Fine, now i use jqgrid together with the laharsub server. It works great!

I manipulate the datas from the server in my specified formats and put them in an array wich is connected with the grid.

So i simply can add and remove grid entries!

Let me say your project laharsub is a very great work and i hope you develop laharsub further!

i'm very interested in some in different backend implementations e.g. SQL

Now i have another general question.

Is it advisable to send long string messages per one publish call or should i split the data and call the publish function many times?

And how is it when the client (the browser) is opened and connected to a subscription permanent? Is there a timeout after a while?

Thank you for your help!


May 6, 2011 at 5:34 AM

How large are your strings? In general I would expect passing one large string would be better than chunking it down yourself, unless that requires you to buffer megabytes up front.

There is no "permanent connection" involved in the HTTP long polling protocol. The client and server cooperate to ensure that the client always has one open HTTP request issued against the server, giving the server the ability to "asynchronously" send messages to the client by responding to that HTTP request. For details check out Architecture & Design.

May 10, 2011 at 4:19 PM

Thank you, i think its possible to send the string per one call, they're not too long!