Good day, I am looking for solution to make custom top navigation menu.
I got site collection and 3-4 nested sites. Builtin top navigation menu shows link like this:
| SiteCollectionLink | NestedSite1 | NestedSite2 | etc.
when i use:
myWeb = SPContext.Current.Web.Site.RootWeb;
PublishingWeb publishingWeb = PublishingWeb.GetPublishingWeb(myWeb);
SPNavigationNodeCollection nodeColl = publishingWeb.Navigation.GlobalNavigationNodes;
foreach (SPNavigationNode node in nodeColl)
{
//node processing
}
i got only NestedSite1 and NestedSite2 as nodes with no main node as it's not in there.
So i wonder how can i take first node?
(builtin navigation menu sohws it as well)
Found out myself, if anyone futher will face it, try this:
SPContext.Current.Site.RootWeb
Related
I'm aware there is a similar question that was asked on here, but this is more specific to vue-echarts. On vue-echarts github page, they state that since version 4.1.0 Vue-Echarts supports ZRender events via zr: prefixed events. I can't really find documentation on how to implement this in vue and am not sure how to go about this. I want to register clicks when a user clicks not only on the bar, but also when they click in the space around the bar.
The following code below only registers clicks when a user clicks directly on the bar.
<v-chart :options="chartOptionsBar"
theme="infographic"
#click="selectBar"
:autoresize="true"
ref="chart">
</v-chart>
The linked post give the following solution for plain js, but i'm not sure how to transform this into something that vue understands. getZr() seemingly does not work with vue.
myChart.getZr().on('click', params => {
var pointInPixel = [params.offsetX, params.offsetY];
var pointInGrid = myChart.convertFromPixel('grid', pointInPixel);
var category = myChart.getModel().get('xAxis')[0].data[pointInGrid[0]]
console.log(category);
});
I tried npm installing zrender but also get the when trying to initialize a zrender object :
./node_modules/zrender/lib/vml/graphic.js
Module not found: Error: Can't resolve '../graphic/text/parse' in '/node_modules/zrender/lib/vml'
This was a bug, but supposedly was fixed, so I'm not sure if this affects the solution as well. Any help would be appreciated! I currently using vue-echarts v5.0.0, zrender v5.0.3.
Figured out the answer of my question by digging into vue-echarts code
Looking at the following commit, to use zrender events with vue-echarts format it the following way:
<v-chart :options="chartOptionsBar"
theme="infographic"
#click="selectBar"
#zr:click="outsideBarClick"
:autoresize="true"
ref="chart">
</v-chart>
and in the methods :
outsideBarClick: function(params) {
console.log(params)
}
Change the import line in ./node_modules/zrender/lib/vml/graphic.js
from:
import * as textContain from '../graphic/text/parse';
to:
import * as textContain from '../graphic/Text';
I am having a really hard time understanding the following problem, i have an app, i use appium inspector to see the elements, but when i use the elements, i get that the element is not found, therefore i printed the code using the driver.getPageSource() method, and i realized that the xml code that is created while running the app, is actually different to what appium inspector sees, what is the problem and how can it be solved? i could ask to the developers to fix it once i know the root cause, thanks in advance.
This is an example of a difference
Under < XCUIElementTypeOther name = Picture, Left Rear Corner> there are 4 more elements 2 StaticText, 2 Buttons (appium inspector) and on the the same element but in the java console, there are only 2 tags, so i do not see the 2 static text and the 2 buttons (which is what i want to click)
As you can see the code in the console is different to what i see in appium iinspector. this is for IOS app.
while (driver.findElementsById("Additional Videos").size() == 0) {
swipeScreenDown();
}
driver.getPageSource();
WebElement additionalVideos = driver.findElementByXPath("//XCUIElementTypeOther[#name=\"Picture, Left Front Corner\"]");
driver.getPageSource();
List<WebElement> idf = additionalVideos.findElements(By.className("XCUIElementTypeButton"));
driver.getPageSource();
System.out.println(idf.size());
driver.getPageSource();
idf.get(0).click();
driver.getPageSource();
Error got:
java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
PageSource() action can print the visual elements at the screen.
As per my understanding, You are currently performing PageSource() action when loading the screen.
You need to click at the selected element
After click on this element use PageSource() action.
You get that element in the log of the PageSource().
seems nobody had this question before...? (or i just don't know the right words for it :D )
i want to have a very basic heading on every page of my app, which allows the user to go "up". simple as that.
example: user is on page.com/users/browse/, clicks on the heading, gets navigated to page.com/users/, clicks again, gets navigated to page.com. nothing more. it just has to be variable, so i can put it in a component and have it just work everywhere
how can i do that? i tried vue.$route, but there is only a string of the complete url. is there any convenient way to do it? or do i HAVE to split the url by / and build the route myself?
thanks :)
Try using this: this.$router.replace("./");
I don't know how it is working though. The single dot(./) will go up one path and double dots(../) will go up 2 paths!
This functionality has a name "Breadcrumbs".
Check this: 1, 2, 3 or look for this in your framework.
Try adding a method for going up one level by getting the route's path and then splitting it. Here's what worked for me:
upOneLevel(){
var upperPath = this.$route.path.split("/")
if(upperPath.length > 0) {
upperPath.splice(upperPath.length-1)
this.$router.push(upperPath.join("/"))
}
}
Then you can add a button that calls this method to go up by one level but no further than the root. This method will work regardless of whether or not your routes were nested properly.
this.$router.replace("./") will help if the user clicks on the heading only once, if he try to clicks again nothing is happen because vue-router avoid redundant navigation to the same location.
You can catch this error then navigate to the root, (or to a named route) if you have only two levels in your routes.
NOTE :
This function works only for two levels (see the example of this Question)
goUp() {
this.$router.replace("./").then(err =>{
if(err)
this.$router.replace("/");
// or : this.$router.replace({name:"home"}); for named routes
})
}
You can get the current path using this.$route.path and than remove the last party by splitting/splicing it:
goUp(){
var upperPath = this.$route.path.split("/")
if (upperPath.length > 2) {
upperPath.splice(upperPath.length - 1)
this.$router.push(upperPath.join("/"))
} else {
this.$router.push('/');
}
}
The already mentioned this.$router.replace("./"); will add a trailing slash.
If this is not your intention, use this.$router.replace(".");
Moreover, if you want to make a new history event, use this.$router.push(".");
My navigation structure looks something like this:
TabNavigator
|
|- StackNavigator
| |
| |- ListA
| |
| |- ShowA
|
|- StackNavigator
| |
| |- ListB
| |
| |- ShowB
ListA shows, as you might expect, a list of resources (type A). Pressing on one sets the state and navigates you to ShowA where you are viewing details about that specific resource.
ListB shows a list of resources (type B), and ShowB also shows a list of resources, however the resources are of type A. When pressing on one of these resources, you should be navigated to ShowA.
If on ListA I press and navigate to ShowA, that works perfectly.
If on ShowB I press and navigate to ShowA, that also works as expected.
However, if I first go to ListA, navigate to ShowA, then (without pressing 'Back' on ShowA) use the TabNavigator and go to ListB, then to ShowB, pressing on a resource opens ShowA but it's another instance of the screen placed on top of the stack. So when I press 'Back', instead of taking me to ListA as would be expected, it takes me to the previously opened ShowA.
I'm sorry if the formatting or explanation of this is inadequate. If anyone can help or if anyone needs more information please let me know and I'll do whatever I can.
You should register two screens using the same component under different screen names. The structure should look something like this:
Tab:
Stack
"Tab1List"
"Tab1Show"
Stack
"Tab2List"
"Tab2Show"
Is there a way to have the categories sidebar menu start in the expanded state? Currently it starts out collapsed and requires the user to expand the top level categories to view the ones underneath.
My store has only one main category right now and I would like to have it expanded unless the user chooses to collapse it
here is a link to the demo page as my site has not been published yet.
http://hawaii-demo.mybigcommerce.com/
[
Since the category list is controlled by a snippet, you would need to use javascript to autoselect/autoexpand that particular parent category.
Something like:
$(document).ready(function(){
if ($('li:contains(parentCategoryName)').hasClass('expandable') {
$(this).addClass('collapsable');
$(this).removeClass('expandable');
}
else {
return null;
}
});
I haven't tested the above script, but that would be one of my first tries. It may require tweaks. You should replace "parentCategoryName" with the name of your parent category that you want to expand.