I have tried using the normal links that would work in a basic mvc project, as well as links similar to what I see in the pages the views but I seems to be getting an error that is only resolved when I add the view as a menu item on the MainMenu, which is not what I want to do. There must be a way around this...
I have a page, 'WorkOrders' (workorders/index), which displays a list of Work Orders. There's a link for creating a new work order, which should go to the 'Create' (workorders/create, I'll also need to get workorders/create/customerid working) page.
<a asp-action="Create">Create New</a>
and
<a href="/workorders/create">Create New</a>
both generate an error when clicked:
Unhandled exception at line 127, column 17 in
http://localhost:62114/js/admin.js
0x800a138f - JavaScript runtime error: Unable to get property 'offsetTop' of
undefined or null reference
Where would I define 'offsetTop'? Is there some other way to solve this error? I'm guessing that if I try to hack it away I'll just get another error to deal with and was hoping to resolve it correctly.
Does this mean it's trying to load this view inside of the shared layout that requires that value to be defined somewhere? I don't see any difference between workorders/index and workorders/create except workorders/index being on the MainMenu.
I see the pages that come with the template as examples all have their own js files, do I need to create similar js files for all of the views I add?
You don't need to create js files for all of the views you add.
Change this in admin.js
:
var activeItemOffsetTop = $('.menu .list li.active')[0].offsetTop
if (activeItemOffsetTop > 150) $el.slimscroll({ scrollTo: activeItemOffsetTop + 'px' });
to this:
var $activeItem = $('.menu .list li.active')[0];
if ($activeItem.length) {
var activeItemOffsetTop = $activeItem.offsetTop;
if (activeItemOffsetTop > 150) $el.slimscroll({ scrollTo: activeItemOffsetTop + 'px' });
This is required to handle pages without its own menu item on the main menu.
User contributions licensed under CC BY-SA 3.0