CraigCav / Knockout-jqGridBinding

A grid binding plugin for Knockout.js that provides basic integration with the JqGrid plugin for jQuery.
MIT License
37 stars 10 forks source link

Editing in jqGrid #2

Closed bkak closed 11 years ago

bkak commented 12 years ago

Nice plugin!!

Can we have editing in this grid?

CraigCav commented 12 years ago

Currently the plugin doesn't provide any extension points for opening up jqGrid's editing facilities [http://www.trirand.com/jqgridwiki/doku.php?id=wiki:inline_editing] to better fit with knockout binding. I haven't given much thought just yet to whether or not this is the appropriate route to take for adding editing support (or instead if providing editing support through knockout might be more flexible). Any feedback on this is welcome!

In theory though, there's nothing stopping you using jqGrid's editing support directly (outside of this plugin) to provide editing features in your grids today.

bkak commented 12 years ago

Thanks for the reply.

Referring to your custom binding we have created a custom binding for jqGrid.

Can u pl review this fiddle :

http://jsfiddle.net/kunjank/naWnV/17/

and tell me if this is the correct way?

Thanks!!

CraigCav commented 12 years ago

Sorry it has taken so long to get back to you.

The binding you've put together certainly does the trick, but it's not particularly flexible/reusable beyond the example usage. To consume this binding, the viewmodel must have specifically named methods (addNew, deleteExisting, editNow etc).

Also having to pass the whole column model and settings inline the page is something I would try to avoid as it requires a lot of additional work to consume and creates a tighter coupling between the view and the jqgrid API.

Perhaps some of the methods that are on the model should/could be moved into the binding itself? Adding and deleteing to the underlying collection should be generic enough to be applied to any collection of records.