Comments (4)
ALTER FUNCTION portal.GetNavigationRecursive(@ParentNavId INT)
RETURNS NVARCHAR(MAX)
AS
BEGIN
DECLARE
@Json NVARCHAR(MAX)
;WITH Nav AS (SELECT TOP 100 PERCENT * FROM portal.Navigation ORDER BY NavOrder ASC)
SELECT @Json = ISNULL(@Json + N', ', N'[ ') + N' { "NavId": ' + CONVERT(nvarchar(max), NavId) + N',
"NavLabel": "' + portal.FormatValueForJson(NavLabel) + N'",
"NavOrder": ' + CONVERT(nvarchar(max), NavOrder) + N',
"NavUri": "' + ISNULL(portal.FormatValueForJson(NavUri), N'') + N'",
"NavGlyph": "' + portal.FormatValueForJson(NavGlyph) + N'",
"NavTooltip": "' + portal.FormatValueForJson(NavTooltip) + N'",
"ViewID": "' + portal.FormatValueForJson(CONVERT(nvarchar(max), ViewID)) + N'",
"ChildItems":' + ISNULL(portal.GetNavigationRecursive(ISNULL(NavId, -1)), N'[ ]') + N' }'
FROM Nav
WHERE NavParentId = @ParentNavId
OR (@ParentNavId IS NULL AND NavParentId IS NULL)
SET @Json = ISNULL(@Json, N'[ ') + N']'
RETURN @Json
END
from crude-asp.
Still need to think how to figure out which nav links should be active or not
from crude-asp.
Get path name:
var segments = window.location.pathname.split('/');
var toDelete = [];
for (var i = 0; i < segments.length; i++) {
if (segments[i].length < 1) {
toDelete.push(i);
}
}
for (var i = 0; i < toDelete.length; i++) {
segments.splice(i, 1);
}
var currFileName= segments[segments.length - 1];
console.log(currFileName);
Dynamically change menu item class:
$('.menu a').each(function() { //li a?
if ($(this).attr('href') == currFileName){ $(this).addClass('active'); }
});
Find an element's parent:
https://api.jquery.com/parent/
Determine whether an element has a class:
https://api.jquery.com/hasClass/
Perhaps I could do it like this:
- Give all sidenav menu links (a) the same class (let's say, nav-link or whatever).
- Find current open page.
- Run jquery to find all sidenav links based on their class, and compare their href attribute against the current open page.
- If equals, run a recursive function which would add the "active" class to all parent (li) elements that don't have the "active" class yet. The recursive function stops when the parent element is not (li) or (ul), or when it already has the "active" class.
from crude-asp.
completed
from crude-asp.
Related Issues (20)
- Column Search from URL Parameters gets overridden by saved client state HOT 1
- When removing URL filter, column dropdown boxes don't reflect change HOT 2
- New Action Setting: Triggered by CRUD Action
- Use URL search parameters to initialize default row
- Utilize the xhr.dt event in DataTables to return additional metadata from server side call
- Change background color of datatable selected rows
- Rewrite Navigation menu function in jQuery
- Add support for dropdown menu instead of treeview HOT 1
- New web UI components HOT 1
- Data view advanced actions
- Fix site root path in inc_metadata file
- Installer packaging and version finalization
- Error handling and Diagnostics
- Firefox browser support: fields unsupported
- Add custom action: Auto-Generate dataview fields
- Actions: API Call - toolbar
- Actions: API Call - inline
- Single-Item Browse Module
- New DataView Rendering Type
- Field property: Filter Required HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from crude-asp.