Closed mattslay closed 11 years ago
Well right now I'm the only developer of OpenJS Grid. I would need someone who knows ASP.net or Ruby to write the logic that I wrote in PHP. I unfortunately don't know either of those 2 languages, so I can't be the one to write those libraries.
Are you familiar with how the jQGrid works in this manner?
For instance, to fetch the initial set of data to display in the grid, notice the url: parameter in the code below:
url: '/Quotes/GetQuoteLineItems/',
So, you see all it does is call a URL and that url responds by posting back a set of JSON data, formatted in a particular way that the grid knows how to parse and then update itself to show the data.
So, it's not specific to Rails, or .Net, or PHP at all. It just needs to know the URL, and the called URL needs to respond with the correct JSON.
My guess is that your works very similarly, and perhaps all I need to know is what the expected JSON response is, and where to put the URL setting in your grid.
Now, we'd have to nail this down for each action that your grid handles that required back-end calls. We can tackle all that if we first see how close we are to this initial flow of communication.
Here's the jQuery grid setup that I use in an Asp.Net page. You can see the column assignments and all, but the main thing the stuff that communicates with the backend.
jQuery(document).ready(function () {
var myGrid = $('#grid1');
var quote_id = $('#Quote_id').val();
myGrid.jqGrid({
caption: "Quote Items",
url: '/Quotes/GetQuoteLineItems/',
datatype: "json",
postData: { 'quote_id': function () { return quote_id; } },
contentType: "application/json; charset-utf-8",
mtype: 'POST',
colNames: ['Item', 'Print', 'Part No', 'Alt Part No', 'Dwg No', 'Description', 'Qty', 'Price', 'Total'],
colModel: [
{ name: 'item', width: '35', align: 'center', editable: true },
{ name: 'print', width: '20', align: 'center', formatter: 'checkbox', editable: true },
{ name: 'partno', width: '120', editable: true },
{ name: 'altpartno', width: '120', editable: true },
{ name: 'dwg_no', width: '120', editable: true },
{ name: 'desc', width: '400', editable: true },
{ name: 'qty', width: '35', align: 'center', editable: true },
{ name: 'price', width: '60', align: 'right', formatter: 'number', editable: true },
{ name: 'total', width: '70', align: 'right', formatter: 'number' }
],
pager: '#pager',
autowidth: true,
shrinkToFit: false,
width: '960',
rowNum: 20,
height: 360
//viewrecords: true,
//gridview: true
});
Sure, so whereas they use the URL parameter, mine uses the action="" attribute on the table element. There are 2 main ajaxes you need to be aware of. One is the main load (and reload) http://jsonfiddle.net/openjsload
And the other is the select box load http://jsonfiddle.net/openjsselect
Save and Delete both just return boolean
So your ASP would have to output this JSON to fill the grid and it would work. I would also need to tell you what to expect POSTwise. But instead of me typing that - You can check your NETWORK tab in chrome for the ajax calls and see all of this data.
I guess I should make an data api document for openJS grid with this stuff documented.
This thing looks really cool, but how about support for Ruby on Rails and Asp.Net MVC?
The basic jQuery Grid works with these back ends, and if yours did too, your user base could increase a lot.
Any chance of you looking into this?