How can I make the table header fixed on top on vertical scroll in antd? I have used css like
position: fixed, top: 0. But these are not working in my case
<DraggableANTGrid
dragProps={this.dragProps}
isDraggable={false}
tableProps={{
rowKey: "IndianExpImpId",
columns: finalColumns,
components: { header: { cell: ResizeableColumn } },
dataSource: rows,
onChange: this.onFilterChange,
size: "small",
scroll: { x: totalWidth + 96, y: 700 },
expandedRowRender: this.getExpandRow,
pagination: false,
rowSelection: {
selectedRowKeys: importExportIds,
onChange: this.rowSelection,
fixed: finalColumns.length > 2
}
}} />
For antd table props, scroll={y: ...} allows you to fix your table header. However, the scroll property is not compatible with expandedRowRender property. You'll have to choose one of them. A possible solution is to use only scroll property, remove expandedRowRender and display it's content in a Modal whenever the row is clicked.
try this prop, i've worked it out..!!
scroll={{x:950,y:"calc(100vh - 220px)" }}
Related
The space for xAxis generally is rendered dynamically by the Highcharts library and add the ellipsis in the correct place, making it display from the start and cutting it when it stop displaying it on the graph with some ellipsis.
When I try to change that space to not render dynamically, the property marginBottom does it,but it stops picking up when the text should start displaying and the start of the text is cutted from the down of the graph. Is there a way to render correctly the text at the bottom from the highcharts? I Do need it to be rotate 270 degrees, and not let the auto rotate work, and don't want to collapse more part of the graph just for displaying the text.
Here is a sample when that happes:
Highcharts.chart('container', {
chart: {
height: 350,
spacingBottom: 0,
marginBottom: 50,
type: "column"
},
series: [{
name: 'Total',
data: [1,2,3,4,5]
}],
xAxis: {
categories: ["very long name to test if the characters are rigth and cropped",
"Not so long but long enough", "I still am long and out of the screen",
"lets see how is cropped", "cropped", "crop"],
labels: {
rotation: 270
}
}
});
Sample fiddle with marginBottom : https://jsfiddle.net/ragmar/6ru4hze3/
If you remove the marginBottom, even the legend move down a bit.
It is possible to do this behavior? even including some css?
Thanks in advance
To make it work the way you want, you have to make some modifications in Highcharts core. For example you can do not use marginBottom option, but set fixed value as a commonWidth variable in renderUnsquish method:
if (attr.rotation) {
commonWidth = (
maxLabelLength > chart.chartHeight * 0.5 ?
40 : // changed from 'chart.chartHeight * 0.33'
maxLabelLength
);
if (!textOverflowOption) {
commonTextOverflow = 'ellipsis';
}
}
Live demo: https://jsfiddle.net/BlackLabel/moL1tw6c/
I need to increase the size of the highcharts, ie; the height parameter.
I'm using the plotAreaHeight parameter but it is not working ie; the height remains the same.
chart: {
// type: 'bar',
plotAreaHeight: 800,
Here is my fiddle.
https://jsfiddle.net/cucjw7xc/8/
As far as I am aware plotAreaHeight is not a configuration option.
Two ways to set the height of your chart:
1) use the height property:
chart: {
height: 800
}
Updated Fiddle:
https://jsfiddle.net/cucjw7xc/9/
2) Set the height on your containing div
#container: {
height: 800px;
}
Updated Fiddle:
https://jsfiddle.net/cucjw7xc/10/
I have a FormPanel being created like this:
Modal.EmailPanel = Ext.extend(Ext.form.FormPanel, {
dock: 'top',
id: 'emailPanel',
name: 'emailPanel',
standardSubmit : false,
styleHtmlContent: false,
width: 200,
height: window.innerHeight - (Ext.is.Phone ? 20 : g_topToolbarHeight),
scroll: 'vertical',
layout: {
type: 'vbox',
align: 'stretch'
},
items: [
... etc.
What happens is that at first it displays correctly:
http://i.imgur.com/TOjG3fQ.png
But as soon as it is scrolled, part of it disappears under Safari's URL bar:
http://i.imgur.com/E2LAwQR.png
I am new to Sencha Touch so I'm not very sure what the issue could be. Any input would be appreciated.
So the problem is that when you scroll down your page that cannot fir inside the browser windows it reveals the bottom section and hides the upper?
Well this is the natual scroll behavior of any browser... even in this page, that cannor fit he window, when you scroll it the upper part slide under the url bar... am i missing something?
Suppose I have two panes in my highstock, can I remove one of the panes dynamically. So if I click on a pane, I should be able to trap the event alongwith the id of the pane(yaXis) and subsequently delete the axis alongwith its series.
I have added the panes dynamically like following( so I axis have Id etc. with me)
chartX.addAxis({ // Secondary yAxis
id: studyName,
title: {
text: studyText
},
isX: false,
lineWidth: 2,
lineColor: '#08F',
//opposite: true,
top: startHeight,
height: 100,
offset: 0
});
var chartToUpdate=chartX.addSeries({
name: 'ADBE',
id: 'studyNew',
color: 'black',
data: studyData,
yAxis: studyName
});
$("#selectStudy").append("<option value='"+countNoOfStudiesAdded+"'>"+studyName+"</option>")
}
Is it possible to delete the pane as mentioned above. Any other method that can help achieve dynamic removal of the pane will be appreciated.
Thanks.
OK I got the solution by tinkering...
The best one was by adding the events such that whenever I click on the legend of the series, its pane is removed.
var chartToUpdate=chartX.addSeries({
name: 'ADBE',
id: studyName,
color: 'black',
data: studyData,
yAxis: studyName,
events: {
legendItemClick: function(event) {
this.yAxis.remove();
countNoOfStudiesAdded--;
}
}
});
If someone wants the exact answer to my question then the solution is to have a dropdown select/option and a button. Once the button is clicked, we find the pane to be deleted from dropdown and then delete it as follows:
$('#remove').click(function() {
if($("#selectStudy").val()!=0) {
var studyToDelete=chartX.get($("#selectStudy option:selected").text());
while(studyToDelete!=null) {
studyToDelete.remove();
$("#selectStudy option:selected").remove()
studyToDelete=chartX.get($("#selectStudy option:selected").text());
}
}
});
where id of button is remove, id of selection dropdown list is selectStudy. So we find all the series attached to the pane having same id as that of yAxis ad delete them.
You can use Axis.remove() function to remove axis.
http://api.highcharts.com/highcharts#Axis.remove()
How to add more textfields in a view on clicking a button in the same view in sproutcore?
I have a sliding pane with particular number of textfields. On clicking a button, I need to add more number of text field in the same view.
Or,
I should be able to select the number from a select button view and show those many number of textfield in the same view.
I would recommend using a SC.ListView for this purpose.
You should have a SC.ArrayController whose content is an array containing objects that represent each text field. This may be as simple as something like this:
MyApp.myController = SC.ArrayController.create({
content: [
SC.Object.create({ someProperty: "Text field value 1" }),
SC.Object.create({ someProperty: "Text field value 2" }),
SC.Object.create({ someProperty: "Text field value 3" })
]
});
Next, you'll create your SC.ListView and bind it's content to the controller, and create the exampleView whose content is bound to the someProperty property of the objects:
MyApp.MyView = SC.View.extend({
childViews: 'scrollView addButtonView'.w(),
scrollView: SC.ScrollView.extend({
layout: { top: 0, left: 0, right: 0, bottom: 50 },
contentView: SC.ListView.extend({
contentBinding: 'MyApp.myController.arrangedObjects',
rowHeight: 40,
exampleView: SC.View.extend({
childViews: 'textFieldView'.w(),
textFieldView: SC.TextFieldView.extend({
// Add a little margin so it looks nice
layout: { left: 5, top: 5, right: 5, bottom: 5 },
valueBinding: 'parentView.content.someProperty'
})
})
})
}),
addButtonView: SC.ButtonView.extend({
layout: { centerX: 0, bottom: 10, width: 125, height: 24 },
title: "Add Text Field",
// NOTE: The following really should be handled by a statechart
// action; I have done it inline for simplicity.
action: function() {
MyApp.myController.pushObject(SC.Object.create({ value: "New Field" }));
}
})
});
Now, when you click the "Add Text Field" button, it will add a new object to the controller array which will automatically re-render the list view with the new object and hence, the new text field.
A couple of notes:
This uses a SC.ScrollView in conjunction with the SC.ListView, you will almost always want to do it this way.
Since we are using standard bindings (not SC.Binding.oneWay()), editing the text fields will automatically update the someProperty property in the objects in MyApp.myController and vice versa: if you update the value via some other means, the text field should automatically update as well.
This should not be used for a large list as using the childViews method of view layout can be slow. If you need performance, you should change the exampleView to a view that overrides the render() method and manually renders a text input and sets up the proper change events and bindings.
Lastly, I can't remember if the proper syntax for the text field's valueBinding is parentView.content.someProperty or .parentView.content.someProperty (notice the period at the beginning). If the first way doesn't work, try adding the . and see if that works.
Like Topher I'm assuming you're using SproutCore not Ember (formerly SC2).
If you need to add an arbitrary child view to an arbitrary location on your view, you want view.appendChild. In the button's action, you would do something like this:
this.get('parentView').appendChild(SC.View.create({ ... }))
If you go this route, you'll have to figure out the layout for the new view yourself. If you don't need to precisely control the layout, then go with Topher's solution - the ListView does the layout piece for you.