I have a page with nested tabview , like this :
<p:tabView dynamic="true" id="tabView">
<p:tab title="tab1">
<p:tabView dynamic="true" >
<p:tab title="subtab1" >
// Some charts : LineChart , PieChart ...
// Labels working
</p:tab >
<p:tab title="subtab2" >
// Some charts : LineChart , PieChart ...
// !! Labels not working !!
</p:tab>
</p:tabView>
</p:tab>
<p:tab title="tab2">
// Some charts : LineChart , PieChart ...
// Labels working
</p:tab>
</p:tabView>
So the problem is that labels are not working in 'subtab2' , if i switch 'subtab2' and 'subtab1' labels work in 'subtab2' and not in 'subtab1'.
In 'tab1' and 'tab2' no problem !
I'm working with primefaces 5.1.
The same code is working in PF 5.2 .
With PF 5.1 , to make it work, change the dynamic attribute to false in the second tabView.
Related
I am trying to make cards on the screen and I want to add a title and icon for that card that title and icon I want to align vertically center of the card. I am trying everything but still is not working
This is my main component
<v-container fluid>
<v-layout row wrap align-center justify-center fill-height>
<v-flex xs12 sm6 md4 lg4>
<v-hover v-slot="{ hover }">
<v-card
:elevation="hover ? 12 : 2"
:class="{ 'on-hover': hover }"
class="primary ma-4 white--text"
height="300"
>
<FirstTile></FirstTile>
</v-card>
</v-hover>
</v-flex>
</v-layout>
<v-container>
This is my FirstTile tag code
<v-flex xs12>
<v-layout align-center justify-center fill-height>
<v-card-title primary-title id="heading">
Profit/Loss
</v-card-title>
</v-layout>
<v-layout align-center justify-center fill-height>
<v-card-action>
<v-icon
x-large
color="white"
> swap_vert
</v-icon>
</v-card-action>
</v-layout>
</v-flex>
Your FirstTile html could be something like this. align-center will fill the space vertically.
<v-container bg fill-height grid-list-md text-xs-center>
<v-layout row wrap align-center>
<v-flex>
<v-card-text >Profit/loss </v-card-text>
<v-icon
x-large
color="white"
> swap_vert
</v-icon>
</v-flex>
</v-layout>
</v-container>
I've been working on PrimeFaces Bar chart model,and its getting on my nerves now,I just can't get how its setting chart series values.What expected result should be that One Open for say abc and one closed for xyz, But what It shows one open and one closed for xyz,ABC is Ignored. If I change the position of
barModel.addSeries(close);
barModel.addSeries(open);
to
barModel.addSeries(open);
barModel.addSeries(close);
Then It shows One open and one closed for only abc,Not xyz.
here's my getBarModel() first,
public BarChartModel getBarModel() {
barModel=new BarChartModel();
ChartSeries open = new ChartSeries();
open.setLabel("OPEN");
ChartSeries close = new ChartSeries();
close.setLabel("Close");
open.set("abc", 1);
close.set("xyz", 1);
barModel.addSeries(close);
barModel.addSeries(open);
barModel.setMouseoverHighlight(false);
barModel.setShowPointLabels(false);
barModel.setTitle("Incident_application");
barModel.setLegendPosition("ne");
barModel.setShowDatatip(false);
barModel.setShowPointLabels(true);
barModel.setExtender("chartExtender");
barModel.setSeriesColors("A2CC39,1B75BA");
Axis xAxis = barModel.getAxis(AxisType.X);
xAxis.setLabel("Applications");
barModel.setAnimate(true);
Axis yAxis = barModel.getAxis(AxisType.Y);
yAxis.setLabel("No. of Incident");
yAxis.setMin(0);
yAxis.setMax(20);
yAxis.setTickInterval("10");
return barModel;
}
and here is xhtml
<h:outputScript library="primefaces" name="jquery/jquery.js" target="head" />
<h:outputScript library="primefaces" name="jquery/jquery-plugins.js" target="head" />
<style type="text/css">
table.jqplot-table-legend {
border: none;
font-size: x-large;
}
div.jqplot-table-legend-swatch
{
width: 2vw;
height: 2vh;
}
div.jqplot-gridData{
display:none;
}
div.jqplot-xaxis-tick{
font-weight:bold !important;
}
.jqplot-axis.jqplot-xaxis{
font-weight:bold;
}
.jqplot-point-label {
font-size: 300%;
color: black;
font-weight: bold;
}
.jqplot-target{
color:black !important;
}
</style>
<script>
function chartExtender() {
this.cfg.grid = {
background: 'transparent',
gridLineColor: '#303030',
drawBorder: false,
};
}
</script>
<h:form id="barChart">
<p:chart id="bar" type="bar" model="#{incidentBarChartController.barModel}" />
<p:poll interval="10" global="false" update="barChart"/>
</h:form>
</h:body>
Snapshots of expected and Actual results are added below.
Expected Result
Actual Result
Edit
After adding
open.set("abc", 1);
open.set("xyz",0);
close.set("xyz", 1);
close.set("abc", 0);
I still get weird results i.e.
1 open and 1 closed for xyz and 0 open and 0 closed for xyz.
The only solution is that you as a developer make sure all series contains all keys and populate the keys which you do not have and make sure all keys in all series are in the same order.
The reason for this is that only you know the real order (that is why a LinkedHashMap is used in the series). jQplot or PrimeFaces cannot know this. If e.g. the first series misses a key and that series is used as the 'primary' to iterate over, where is the missing key going to put. And if e.g. at position 6, both have a key that is not in the other set, which one should be taken first? The jqPlot or PrimeFaces cannot know. All reasons that you as a developer should make sure it is explicit by putting all keys in all series.
I am using primefaces 3.5RC1 and want to rotate tick labels of bar chart.I wrote the code below,and rotated tick labels.However,tick labels turned into numbers.Tick labels should have been strings like 'No Family' or any other fanily name.How can i fix this?
function barChartExtender(){
this.cfg.axes= {
xaxis: {
tickRenderer: $.jqplot.CanvasAxisTickRenderer,
tickOptions: {
angle: 60
}
}
};
}
The labels after rotation
The labels before rotation
Please help...
Thanks.
You don't need to set tickRenderer: $.jqplot.CanvasAxisTickRenderer or any extender for rotation.
For PrimeFaces versions earlier than 5.0, use xaxisAngle attribute on your component like;
xaxisAngle="-50" like:
<p:barChart id="basic" value="#{chartBean.categoryModel}" xaxisAngle="60"
title="Basic Bar Chart" min="0" max="200" style="height:300px"/>
For newer versions see:
Primefaces 5 Rotated Axis Tick Labels
How to set a scrollbar position of primefaces datatable from last to first?
Actually, I want see the information from bottom to top. Below is my code:
<p:dataTable var="c" value="#{MessagingUserBean.inboxDetails1}" scrollable="true" scrollHeight="517" liveScroll="true" emptyMessage="No Message Found" scrollRows="8" scrollWidth="815" >
Well you can try to not use a liveScroll because you then don't know the end of dataList. Try this and maybe this suit your needs. This will scrolldown to the bottom of your dataTable with a delay.
<h:form prependId="false">
<p:dataTable id="dataTable" var="c" value="#{MessagingUserBean.inboxDetails1}" scrollHeight="517" liveScroll="true" emptyMessage="No Message Found" scrollWidth="815" >
//Your dataTable stuff
</p:dataTable>
</h:form>
<script>
//Get the scrollheight
var s = jQuery('#dataTable .ui-datatable-scrollable-body').prop('scrollHeight');
//Get total size of datatable
var o = jQuery('#dataTable .ui-datatable-scrollable-body').prop('offsetHeight');
//calculate how many times it can scrolldown to set your timer
var t = Math.ceil(s/o);
//Excute scrolldown animation (max scrolldown is scrollHeight - offsetHeight)
$('#dataTable .ui-datatable-scrollable-body').animate({scrollTop:s-0}, t*1000);
</script>
You will need some javascript to do this.
var $scrollable = $(dataTableSelector).children('.ui-datatable-scrollable-body')[0];
$scrollable.scrollTop = $scrollable.scrollHeight;
Where "dataTableSelector" is a selector for your primefaces table (a styleClass for example).
Of course, this assume that the last element in the list you're displaying is actually the first you want to show.
I'm trying to get an element to move from right to left in XUL. I am doing this with a toolbar and want one toolbarbutton w/ a label to remain anchored to the right, while one of them moves from right to left, starting to the left of the anchor.
I'm trying to achieve this effect by modifying marginLeft, but my element stays still. I'm not really sure why it does not move.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE overlay >
<overlay id="my-overlay" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<script type="application/x-javascript">
// Install load handler
var marginLeft = 0;
window.addEventListener("load", function(e) {
function moveIt() {
document.getElementById("moveit").style.marginLeft = marginLeft + "px";
marginLeft -= 30;
}
setInterval(moveIt, 1000);
}, false);
</script>
<vbox id="browser-bottombox">
<toolbar id="theToolbar">
<!-- holds the scrolling items and the refresh time -->
<hbox id="scrollingItemContainer" flex="1" align="end">
<!-- container for our scrolling items -->
<spacer flex="1"/>
<hbox id="movingItems" align="end">
<toolbarbutton id="moveit" label="moving"/>
</hbox>
<hbox>
<toolbarbutton id="rightAnchor" label="right"/>
</hbox>
</hbox>
</toolbar>
</vbox>
</overlay>
Any help you can provide will be helpful. I've tried this on FF4, but I think the problem exists on FF3 as well.
I should note that if I add a spacer with flex=1 after scrollingItemContainer then I see the item move, but it is not anchored to the right.