Go Back   Access World Forums > Apps and Windows > Web Design and Development

 
Reply
 
Thread Tools Rate Thread Display Modes
Old 12-15-2017, 08:04 PM   #1
Cowboy_BeBa
Newly Registered User
 
Join Date: Nov 2010
Posts: 182
Thanks: 55
Thanked 4 Times in 4 Posts
Cowboy_BeBa is on a distinguished road
working with MVP and creating a Filtered Detail List

Hi All

Just a bit of background before getting started, ive been developing access databases for years and consider myself very proficient in them. Recently ive looked into rebuilding a DB i made for work into a web app and selling it off to other companies (work is cool with this as i made their entire db on my own from scratch).

Im okay with web design but wanted this to be perfect (especially in terms of security, wasnt confident i could create something that would keep my clients data secure). So i outsourced a lot of the coding to india. The devs over there did an excellent job, but they used an MVC framework (which i am completely unfamiliar with, i specified simple html pages linked to visual CS pages which i could then understand and alter as needed, this MVC stuff is confusing the hell outta me)

Was just wondering if someone could give me some basic pointers on MVC's and how they work (for instance i can see the model of my DB, based in mysql, wondering if i change a table or a query in the db, does the model need to be updated? if so how? am using the latest version of Visual Studios to develop if that makes a difference)

Secondly, in order to make this project much cheaper (they originally quoted 25k) i left out a few pages which i intend to design (i figured i'd give them the more complex ones and then i could use their code for reference to create some of the simpler ones, since they dropped the price down 10k it made things much more affordable). This is fine as im visual studios inbuilt scaffolding feature in order to generate new pages, then i just have to muck around with the HTML in order to get them to look similar to the other pages.

One of the pages i need to make is basically a list of one of my tables. Just a simple details list which the user can then edit or delete records if they need to. This is simple enough but the tricky part is that i need to allow the user to be able to filter each and every field they wish. For instance there is a "Stock" field, user should be able to select one (or more) products they wish to view records for, then theres a date field, user should be able to specify a date, or search for records between two dates. There are many such fields and i need each one to be filterable.
Have absolutely no idea how to accomplish this. I dont need to be given the exact solution (i like figuring these things out for myself, best way to learn), but i would appreciate someone pointing me in the right direction (not even sure what to call the type of page i wish to create)

Thank you all for reading

Cowboy_BeBa is offline   Reply With Quote
Old 12-16-2017, 01:13 AM   #2
jleach
Newly Registered User
 
jleach's Avatar
 
Join Date: Jan 2012
Location: New York, NY
Posts: 244
Thanks: 15
Thanked 57 Times in 57 Posts
jleach will become famous soon enough
Re: working with MVP and creating a Filtered Detail List

Hello,

The MVC pattern is very popular for web development (for good reason: it suits it very well). That said, it's not the easiest thing in the world to describe, but I'll give it a go:

MVC = Model View Controller
Model: contains data (like a recordset, sort of...)
View: contains the actual markup for the HTML
Controller: receives requests, gathers data, applies to view, sends response

So a request comes in to, say, mysite.com/Home/Tasks. The "Home" controller receives the request in the "Tasks" action, says "get me the latest tasks" from elsewhere in the system, then says "let's take this view, embed the data, and send that back"

So in C# ASP.NET Razor syntax, a View might be a template mixed with HTML and C#:

Code:
@model List<My.Namespace.TaskItem>

<html>blahblah
<ul>
@foreach(var ti in Model) {
  <li>@ti.TaskName</li>
}
<ul></html>
This would be a template that basically says: for a given list of task items, loop each item and print a listitem in the html.

The actionable controller method then might be something like this:

Code:
public ActionResult Tasks() {
   List<TaskItem> model = _dataRepo.GetActiveTasksList();
   return View("NameOfMyTemplateFromAbove.cshtml", model);
}
That says "ok, incoming request for Tasks page: let's get all the recent tasks as the model, and apply them to the View, then return the result of that merge"


That's MVC in a nutshell.

The more difficult part I think is that people don't often realize at first that MVC is a presentation level pattern only! That is, the data can come from anywhere. In fact, it shouldn't actually come direct from a database, but rather through some other model. In the controller example, I had a _dataRepo object in there that might have served as some sort of data repository. That's where you might have code that fetches your data (or just works up a simple test list without a database, etc).

As for listing tables and having them filterable, that's actually quite easy. Just find a decent javascript tables library that allows you to do so (I like the DevExtreme components myself, but there's plenty other free ones around)


Also, just to be clear: the MVC pattern is used by multiple development platforms: Spring, Swift, ASP.NET, Laravel, Angular, etc. Not sure which you're working with, but the core concepts (the pattern) are the same across all. Not to be confused with other presentation level patterns such as MVP or MVVM.

Not sure if that helps or not, but if you want some clarification just ask. Cheers
__________________
- Jack D. Leach

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

Microsoft MVP 2012-2016

Last edited by jleach; 12-16-2017 at 01:20 AM.
jleach is offline   Reply With Quote
Old 12-16-2017, 01:18 AM   #3
jleach
Newly Registered User
 
jleach's Avatar
 
Join Date: Jan 2012
Location: New York, NY
Posts: 244
Thanks: 15
Thanked 57 Times in 57 Posts
jleach will become famous soon enough
Re: working with MVP and creating a Filtered Detail List

Here's a demo of the DevExtreme data grid. Telerik has a similar one as well. Use the nav on the left of the page to see demos of different modes and features:

https://js.devexpress.com/Demos/Widg.../jQuery/Light/

You can see the datagrid configuration options here: https://js.devexpress.com/Documentat...ts/dxDataGrid/

(note: stay away from the DevExpress MVC extentions: they're terrible, but the DevExtreme are all javascript based and have far better support than most open source libraries)

__________________
- Jack D. Leach

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

Microsoft MVP 2012-2016
jleach is offline   Reply With Quote
Old 12-16-2017, 01:30 AM   #4
jleach
Newly Registered User
 
jleach's Avatar
 
Join Date: Jan 2012
Location: New York, NY
Posts: 244
Thanks: 15
Thanked 57 Times in 57 Posts
jleach will become famous soon enough
Re: working with MVP and creating a Filtered Detail List

Quote:
for instance i can see the model of my DB, based in mysql, wondering if i change a table or a query in the db, does the model need to be updated?
Generally speaking, yes. One thing we have to do a lot of in .NET is mapping. Map db fields to DTOs, DTOs to domain models, domain models to view models, etc. Gets old after a while, so you start looking at automapper tools.

Anyway, this is actually out of the scope of MVC itself (remember in my prior post I noted that many people confuse the fact that MVC is a presentation layer pattern only).

A common approach is a to have what's called a 3-tier architecture: a data layer, a "logic" layer (your basic classes), and a presentation layer. The presentation layer calls up objects from the logic layer, which are filled with data from the presentation layer. In such case, if you change a field name (why would you?), you would have to edit the appropriate mappings in the data layer.

With that said, there's about 1000 ways of doing this and just as many tools, libs and frameworks to help with it, so giving something definite is very difficult.

I would suggest using a dependency mapper of some sort to try and identify the core areas of the project and understand how they have the project architecture set up. You'll need to know that prior to being able to make appropriate changes, I think. If you want, expand everything in the solution explorer, post a snapshot of the solution explorer here and I can try to advise on what I can infer from it (also worth noting: overseas work isn't always the best quality, often the appropriate roles of each area are muddled and the nice clear lines between separations of concern don't end up being nice and clear, etc. - anyway, post the solution explorer snapshot (with all projects expanded) and I'll see what I can get from it)

__________________
- Jack D. Leach

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

Microsoft MVP 2012-2016
jleach is offline   Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Not in list event not working on filtered combo box joycey Modules & VBA 10 03-25-2013 05:25 AM
Creating new records within a filtered form mrFlibble47 Forms 6 04-30-2008 06:07 AM
Need help creating multi-filtered reports. Bcole Reports 2 03-01-2005 08:47 PM
How to display filtered records list of the form in the list box? asiamisia Modules & VBA 2 08-08-2004 11:23 PM
creating reports from filtered lists skate Modules & VBA 5 11-20-2002 08:42 AM




All times are GMT -8. The time now is 12:59 PM.


Microsoft Access Help
General
Tables
Queries
Forms
Reports
Macros
Modules & VBA
Theory & Practice
Access FAQs
Code Repository
Sample Databases
Video Tutorials

Sponsored Links

How to advertise

Media Kit


Powered by vBulletin®
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
(c) copyright 2017 Access World