killent / flexigrid

Automatically exported from code.google.com/p/flexigrid
0 stars 0 forks source link

Create a more flexible json type. #44

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Hi folks, I just started to try out your lib, it's really awesome but I would 
sugest,I'm going to try implement it this week, when I do it I will send to 
you, any way, here my idea: 

create a new dataType, something like 'json-array' in order to process an array 
os rows like: 
[
   {fiedl1: 'value for field1', field2: 100, fieldN: 'value N'},
   {fiedl1: 'value for field1', field2: 100, fieldN: 'value N'}
];

this way is more simple to whom use java it's json libraries, so I would be 
able to return a List of Model Objects from my Servlets directly to the page 
just by parsing it to json.

ex: a list of clientes with name and age would return
[
  { cliName: 'my name', cliAge: 23 },
];

you can get the size using the size of the array.

What do you think about it ?

Any way I'm going to implement it and send to you, thanks in advice for your 
attention, sorry by my english - not my mother tong.

Original issue reported on code.google.com by lokidark...@gmail.com on 15 Jun 2011 at 3:15

GoogleCodeExporter commented 9 years ago
Hi folks, I'm here again, it was faster then I imagined. I managed to get the 
code working and now I can render a json into the format I did propose before. 

The diff file of the changes I've made follow attached.

As I said before, it can handle a json array of objects filling the table by 
the name of the columns get from the column model. I don't know if this is good 
for you, but it make my work simple and my java code become something like:

List<Client> clients = entityManager.createNamedQuery("Client.findAll", 
Estado.class).getResultList();
json.serialize(clients, response.getOutputStream());

So, it's really awesome to see it working :)

Original comment by lokidark...@gmail.com on 15 Jun 2011 at 4:07

Attachments:

GoogleCodeExporter commented 9 years ago
Hi, I'm here again... sorry by bother you with this bug report, this is my 
first time working with pagination. Now I realize why you need the other 
parameters as total, for calculate the pages. So, please close this "non bug 
report" :)

Sorry by waste your time ( and mine lol ).

Original comment by lokidark...@gmail.com on 15 Jun 2011 at 5:09

GoogleCodeExporter commented 9 years ago
For big and complicated data JSON with named keys are recognized.

Original comment by ymkin....@gmail.com on 16 Jun 2011 at 9:16