PDA

View Full Version : [CLOSED] MVC - Grid CRUD with Form in a Window - Best Practices



registrator
Jul 17, 2014, 8:53 AM
Hi all

Since I am new to Ext.NET and I see there are many ways for developing a certain functionality I would like to inquire abut the best practice solution when it comes to CRUD operations, grid and the record details presented in a window form.
Do you post the model to the view (MVC style) and bind it to Store or have a separate service method (store proxy) for this...? Or something else? When it comes to sending the ID's over to the server for presenting the record details window and refreshing the grid after the update, delete or new insert, what would be the most convenient architecture?
I understand this is a very generic question but I can't afford to waste time on a solution that will give me problems in further development and maintenance in the future and I scrap it eventually. A blog post or a working example(s) would also do. I have downloaded the MVC examples from your website and there I have seen that you use different methods so at the end of the day, what would you choose?

Thank you

Daniil
Jul 17, 2014, 3:08 PM
Hi @registrator,

Welcome to the Ext.NET forums!

It is nice that you ask about how to do before doing something.

Let's go step by step.


Do you post the model to the view (MVC style) and bind it to Store or have a separate service method (store proxy) for this...?

Well, it depends. Sending data set to a Store via a Model might be actual for a small data set. If you apply data to the Store's DataSource or Data, it means that all the data will be rendered directly to the page. So, it is OK with a small data set, but it might be a problem with a big data set. The bigger data set => the bigger page => the more time of rendering that page. There are no certain numbers how to treat - a data set is big or small. It mostly depends on amount of rows, columns and how complex that columns (for example, you might use a complex Column's Renderer). Approximately, I would say 100 rows * 10 columns might be good to load at once. Sure, usually we deal with much bigger data sets in the real world. It might be thousands of rows. So, it is not going to work if load everything at once. Also it means what you will probably need remote paging, filtering, sorting. It is quite simple to organize that functionality with a Store's Proxy. So, for big data sets a Store's Proxy is a way to go.

So, could you estimate how big data set you are going to deal with?

registrator
Jul 18, 2014, 7:52 AM
Hi Daniil

Thank you for your answer. I think I will go for the "load all at once" approach but I am mostly interested in is what is the best architecture (and possibly how to accomplish) when you want to have a window with a form for edit, update, new and how would you get the ID of the record, present the full data for the record, post it back to controller method and refresh the grid. The form should also have a number of foreign key linked drop downs. Another possible architecture concern.
I believe you understand what I would like to accomplish.
If you know of examples within your MVC examples, just point them up for me please.

Thank you

Daniil
Jul 18, 2014, 3:26 PM
when you want to have a window with a form for edit, update, new and how would you get the ID of the record, present the full data for the record

I think this example is good to start with.
http://mvc.ext.net/#/GridPanel_Update/Batch/


post it back to controller method and refresh the grid

Do you want to post it back from a Window and refresh the entire GridPanel?

Well, I would recommend to consider an approach to put everything (updated, deleted and new data) to a Store (a GridPanel's one) on client side, then synchronize the Store.

store.sync();

Well, exactly as it is done in the example.

registrator
Jul 21, 2014, 1:03 PM
Hi Daniil

I have looked at the example you pointed out and I don't feel comfortable going that way. That approach requires CRUD manipulation on the client (javascript) side and my skills are stronger on the .NET MVC part so I will look for an approach that is more "MVC like". By this I mean: send over the view model from the controller method to the view, on button click get an ID value of the grid row and post it to the controller method for CUD method, present a view (partial view in Ext.NET case, i guess) form in a window holding the individual record view model populated by the ID, send back the view model back to POST method for update.
I see that I can keep Data Annotation on the View Model for client text display and form validation.

Should I keep posting my questions here or should I open new threads for them?

Thank you

Daniil
Jul 22, 2014, 12:09 PM
Should I keep posting my questions here or should I open new threads for them?

Let's say, post here. If we consider that a new thread is better for a specific question, we will do that.