-
Notifications
You must be signed in to change notification settings - Fork 103
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to render Nested ViewModels, collections #44
Comments
There's a pull request open with some code to fix that, but it needs work
before I accept it: #34
You can maybe use the changed FormFactory.js from that?
…On Wed, 22 Feb 2017 at 18:56, weedkiller ***@***.***> wrote:
hi I saw the one sample on collections,
but I was not able to get it to work with 2 nesting levels
For ex. show the Student Week Schedule with student Hours,
-
showing days on top <monday, tuesday, >
-
and classes on the side like this image <http://bit.ly/2lGumKB>
public class StudentWeekVM
{
public StudentWeekVM()
{
Records = new List<ClassTimeGroupVM>();
Totals = new List<LabHoursEnteryVM>();
for (int i = 0; i < 7; i++)
{
Totals.Add(new LabHoursEnteryVM());
}
}
[DisplayFormat(DataFormatString = "{0:dddd d MMMM yyyy}")]
public DateTime WeekEnding { get; set; }
public StudentVM Student { get; set; }
public List<ClassTimeGroupVM> Records { get; set; }
public List<LabHoursEnteryVM> Totals { get; set; }
public decimal GrandTotal { get; set; }
public int SelectedProject { get; set; }
public int SelectedClassDayOrNight { get; set; }
public IEnumerable<SelectListItem> Projects { get; set; }
public IEnumerable<SelectListItem> ClassDayOrNights { get; set; }
}
public class ClassTimeGroupVM
{
public ClassTimeGroupVM()
{
TimeRecords = new List<LabHoursEnteryVM>();
Total = new LabHoursEnteryVM();
for (int i = 0; i < 7; i++)
{
TimeRecords.Add(new LabHoursEnteryVM());
}
}
public ClassDayOrNightVM ClassDayOrNight { get; set; }
public List<LabHoursEnteryVM> TimeRecords { get; set; }
public LabHoursEnteryVM Total { get; set; }
}
public class ClassDayOrNightVM
{
public int ID { get; set; }
public string Name { get; set; }
public ClassesVM Project { get; set; }
}
public class LabHoursEnteryVM
{
public int? ID { get; set; }
public decimal Hours { get; set; }
}
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#44>, or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAQ0-gzCYGbFtyxRoc-RDrOBYnmJNICyks5rfITMgaJpZM4MJC6v>
.
|
@mcintyre321 - hey, just wondering if there has been any movement on nested collections or how we should interact/use them. |
The PR with nested collections can't be accepted in it's current state. If someone is able to extract the code from that PR for making the nested collections work and send a PR I will happily accept. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
hi I saw the one sample on collections, fro ASP MVC 5
walking down the collection
StudentWeekVM
but I was not able to get it to work with 2 nesting levels - can you please show me how I would wire this up? and on submit does it submit the entireStudentWeekVM
collection it containsFor ex. show the Student Week Schedule with student Hours,
showing days on top <monday, tuesday, >
and classes on the side like this image
The text was updated successfully, but these errors were encountered: