Why can't I used the same dataIndex value for multiple columns of antD table? - antd

For example i wanted to do this,
{
title: 'Configurations',
dataIndex: 'configurations',
key: 'configurations',
render: (configurations) =>(
},{
title: 'TitleID',
dataIndex: 'configurations',
key: 'titleId',
render: (configurations,source) =>()}
I wanted to use the configurations as the data source for two different columns but it kept crashing me. I'm not sure If I am doing something wrong or is it not allowed. I tried searching the antD table docs but it doesn't seem to say anything about this.
https://ant.design/components/table/

Related

Highcharts: SeriesMapping with CSV

I have a chart that works very well when using the data module with Google spreadsheets. However I need to stop using Google sheets and use CSV on my own server instead. Some of my charts are working, but some aren't. Here's one that is not working. It uses the second column to set the point color, but it's not recognizing it. Any idea what might be wrong here? I edited some of the csv entries to try to make it work, but it's not working much:
http://jsfiddle.net/jmunger/cf6L4bmk/20/
var chart = Highcharts.chart('gfx', {
chart: {
type: 'bar',
},
data: {
csv: document.getElementById('csv').innerHTML,
itemDelimiter: ',',
seriesMapping: [{
color: 2,
label: 3
}]
}
});
console.log(chart);
That problem seems to be a bug in a data module, so I reported it here: https://github.com/highcharts/highcharts/issues/13283
As a workround you can use other color formats:
0;1;blue
1;2;rgb(155,155,55)
2;3;red
Live demo: http://jsfiddle.net/BlackLabel/0gjbn4m6/1/

Create a heatmap using highcharts through csv

I need to upload a csv made like this
rsid Complex score
rs531730856 ARNTL.SwissRegulon -0.1658514285714286
rs531730856 BHLHE40.SwissRegulon 0.033113124999999966
rs531730856 BMAL1_HUMAN.H10MO.C -0.16585214285714286
rs531730856 CUX1_HUMAN.H10MO.C 0.10511399999999993
rs531730856 DR-1 0.33170428571428573
Problem is that highcharts returns me error 14 which, if I understood correctly, it's because the Complex field it's not a number. Is there a way where i can import directly a csv made like this?
Unfortunately not, you'll have to do an intermediate step to process that CSV if you wish to import it directly via the csv data/url functionality built into highcharts.
See: https://www.highcharts.com/docs/working-with-data/data-module
CSV can be loaded in two ways. Either data.csv, that holds a CSV
string to be read into the chart, or, since v6.1, data.csvURL that
points to a file location. By default, the first row of the CSV data
is interpreted as series names, the first column signifies category
names or X values/dates, and subsequent columns hold data values.
Sample CSV contents:
Categories,Apples,Pears,Oranges,Bananas
John,8,4,6,5
Jane,3,4,2,3
Joe,86,76,79,77
Janet,3,16,13,15
Sample chart initialization:
Highcharts.chart('container', {
chart: {
type: 'column'
},
data: {
// enablePolling: true,
csvURL: window.location.origin + '/studies/data.csv'
},
title: {
text: 'Fruit Consumption'
},
yAxis: {
title: {
text: 'Units'
}
}
});

Hide column in Grid at runtime

I have a trouble about hiding columns in a Grid at runtime.
In a project I use a function that returns the configuration of a column in a Grid.
For take the list of my columns in the Grid I use this piece of code:
var cmV = cmpGrid.getView();
var cmH = cmV.getHeaderCt();
var cm = cmH.getGridColumns();
The variable "cm" returns an array with the configured columns in the grid.
When I manually hide a column with the "column" option in the header Grid with ExtJS version 3.4.1 I can get the property
hidden:true
for the configured column.
But with ExtJS 6 the configured column doesn't include this property.
How I can resolve this issue?
Thanks at all in advance,
Lorenzo.
**
UPDATE
**
I have discovered this about my previous question.
With
var cm = cmH.getGridColumns();
I can get the array of the columns in the grid.
Analyzing this array with Firebug I had found the subarray "config" that contains the properties required by the columns for the configuration.
However now this array doesn't reflect more the changed configuration of a column but the default configuration applied.
My first question is if this new behavior is a bug or not.
Because I have found this new behavior I have changed my code to get the properties of a column not from the subarray config but from the radix. However now the possible configurations are so much.
Now my second question is if there is a way to reduce or to have only the principal properties for type of columns in a grid.
Why not just use grid.columns[index].setHidden(true) ?
Or if you want to take the list of columns, how about reconfigure columns.
var tempColumns = [];
// "cm" returns an array with the configured columns in the grid
cm.forEach(function(e) {
if (some conditions) {
tempColumns.push({
xtype: e.xtype,
text: e.text,
dataIndex: e.dataIndex,
hidden: true,
width: e.width,
align: e.align,
format: e.format
});
}
else{
tempColumns.push({
xtype: e.xtype,
text: e.text,
dataIndex: e.dataIndex,
hidden: e.hidden,
width: e.width,
align: e.align,
format: e.format
});
}
});
grid.reconfigre(null, tempColumns);
https://fiddle.sencha.com/#fiddle/17lq

Alasql - Having columns with sub-columns

http://i.stack.imgur.com/OfaPs.png
I am attempting to do nested columns similar to the image I have linked above, as I have multiple columns that are grouped to a single header but I'm not sure how to do this.
I was assuming I could do something like:
var options = {
columns: [
{
title: Event,
columns: [{columnid:'event_id', title: 'Event ID'},
{columnid:'event_name', title: 'Event Name'},
{columnid:'event_vendor_id', title: 'Vendor ID'},]
}
]
}
This doesn't work though, and looking through the source code I'm not certain there is a way to accomplish what I'm attempting.
If anyone has any suggestions I would greatly appreciate it, thanks!

JqGrid Hide/Show columns

I have an MVC project, and am working on a page using JQGrid. I have a flyout menu with lots of checkboxes (one for each column of the grid), and I am trying to attach a script to hide/show a column on click.
I've read lots of solutions, and tried using the hide/show methods from the wiki.
$("ShippingListGrid").hideCol("Open");
"Open" is the name of the column in the colModel
{ name: 'Open', index: 'Open', width: 120, align: 'left', editable: true,sortable: true,hidden: false,Key: false, edittype: 'text', editoptions: { size: 20, maxlength: 30}},
This doesn't seem to work though, when I call the function my grid does not change. I've tried reloading my grid and using the column id instead of the name, and the columns still don't change. I've got the latest download. Does anyone know why the function might not be working?
Check your selector, if your grid is a table ID, you will need the # symbol. Maybe try: $("#ShippingListGrid").hideCol("Open");

Resources