Mixing the grid and other fields on the same page

Jul 16, 2013 at 9:45 AM
Hi,

How do set up the view page to handle other fields being displayed along with the grid? for example, I'd like the top half of the screen to show customer details and the bottom half to show the grid listing that customers invoices...

Thanks for any pointers!

cheers!
dj
Coordinator
Jul 16, 2013 at 10:33 AM
Hi, sorry I don't understand what you mean under "top half of the screen"? You would like to setup height of the grid?
Jul 16, 2013 at 11:57 AM
Hi Bukharin,

I figured out to do it. But I do have another question, can you turn on in line editing, i.e. click on a row and edit the cell values 'in the grid' (no pop-up dialog).

Thanks!
dj
Coordinator
Jul 16, 2013 at 2:38 PM
There is no out of box inline editing feature. You need to implement them manually, using javascript.
Jul 16, 2013 at 3:29 PM
hi,

Thanks!, yet another question. Is there an example of adding a button column in the grid?

Cheers!
dj
Coordinator
Jul 16, 2013 at 4:09 PM
Sure, use RenderValueAs method:
        columns.Add()
                .Encoded(false)
                .Sanitized(false)
                .SetWidth(30)
                .RenderValueAs(o => @<button type="button">click me!</button>);
Jul 17, 2013 at 8:48 AM
Hi Bukharin,

Thanks for the sample. I've tried setting the onclick parameter but that doesn't seem to work as the whole row is selected on clicking the button. How do I trap the onclick? is that implemented in jquery?

cheers! and thanks for your help... :)
dj
Coordinator
Jul 17, 2013 at 10:34 AM
Yes you can trap on click using jquery:

$(".grid-table button").click(function(){ alert('click'); });
Jul 17, 2013 at 11:10 AM
ok, cool!

Thanks..

dj
Jul 17, 2013 at 2:25 PM
Hi Bukharin,

The scenario is a customer can have zero or many invoices. The viewmodel has the customer details such as name and address etc. and a list variable containing the invoices. The view displays the customer details and under that I use the grid to display the invoice records.

What I would like to happen is for the user to amend any customer details or invoice record details then click the save button which updates any invoice records then updates the customer record in the database.

I have 2 issues at the moment, 1) The checkbox column isn't picking up the checked state, 2) I have a link column which should display an edit dialog but clicking this link calls the main controller which does the updates, How do I limit the call to the dialog?

Any pointers/examples would be much appreciated!

Cheers!
dj
Coordinator
Jul 18, 2013 at 9:10 AM
  1. Please show your code how you determine checked state?
  2. We discussed in near thread how to edit grid items in popup. Please see - https://gridmvc.codeplex.com/discussions/449554