I'm using ClosedXML it has a method called InsertData to insert a DataTable like this:
var rangeWithData = worksheet.Cell(row, cell).InsertData(dataTable.AsEnumerable());
as mentioned here: ClosedXML Inserting data
In my xml I have one merged column and it causes to miss one column from the data table.
Is there a way to handle it and still use the InsertData method or should I loop over the data table...?
You can use InsertData if you know beforehand which cells are merged and prepare the DataTable accordingly.
If you don't know that you have to use loops and move the data when you get to the merged cells.
Related
I have a abstract table (table or treetable view does not matter) view which have lots of column. But not all columns are visible at the same time. Now what i want to do, when i export the table contents to pdf/excel read each row data but actually in javafx we can not get row and cell data directly. For this we must use row/cell factory. But in this case this factory is called only when we add data to the table. I can read table data model for each row but in this case i must chek which columns are visible and invisible and which data model used always, and call the required method of the data model. Doing this required lots of code lines because as mentioned i have lots of column and nested column and also different data models. So during exporting to check all of these required lots of code line. But if i can read the row and cells of row i do't need to check invisible row and data model. Just read current row and data of cell. So my question is how can i solve this issued? Do you have any suggestion?
Any suggestion?
finally I solved this problem. Thanks for java documentation. I post some code snippet so who needs can use. For reading cell value on (row,column) intersection on TreeTableView
int rowIndex = treeTableView.getRow(treeRowItem);
for(int i=0;i<treeTable.getColumns();i++){
TreeTableColumn ttc = treeTable.getColumns().get(i);
String value = ttc.getCellData(rowIndex).toString();
}
you can also use the same logic on TableView
How do I get the search/filter to work per column?
I am making small steps in building, and constantly adding to my data table, which is pretty dynamic at this stage. It basically builds a datatable based on the dat that is fed into it. I have now added the footer to act as a search/filter, but unfortunately this is where I have become stuck. I cannot get the filer part to work. Advice greatly appreciated.
here is my sample data tables that I am working on http://live.datatables.net/qociwesi/2/edit
It basically has dTableControl object that builds by table.
To build my table I need to call loadDataFromSocket which does the following:
//then I have this function for loading my data and creating my tables
//file is an array of objects
//formatFunc is a function that formats the data in the data table, and is stored in options for passing to the dTableControl for formatting the datatable - not using this in this example
//ch gets the keys from file[0] which will be the channel headers
//then I add the headers
//then I add the footers
//then I create the table
//then i build the rows using the correct values from file
//then I draw and this then draws all the row that were built
//now the tricky part of applying the search to each columns
So i have got this far but the search per column is not working. How do I get the search/filter to wrok per column?
Note this is a very basic working example that I have been working off: http://jsfiddle.net/HattrickNZ/t12w3a65/
You should use t1.oTable to access DataTables API, see updated example for demonstration.
Please compare your code with jsFiddle in your question, notice its simplicity and consider rewriting your code.
I am new to handsontable.
My handsontable rows are readonly.
I wanted to remove all rows of handsontable on a button click.
Please help me.
Do update with empty dataset:
handsontableInstance.updateSettings({
data : []
});
This removes all rows (and leave header if there is some).
There are many ways to "remove" all rows. For example, one, and the easiest, would be to empty your data array. So say that you initialized your HOT instance with the data field as array dataArray. Your button would only need do:
$("#buttonId").click(function() { dataArray = [];})
That would be the easiest way but of course you'd be bypassing HOT. This means that if your application gets more complex and you rely on handlers such as afterRemoveRow, then this method will bypass them. In this latter case, you'd want to use the hot.alter() method as follows:
hot.alter('remove_row', 0); // would remove the row at index 0;
With this I am assuming you know how to use a for loop that could iterate through all rows and remove them, one by one. An expensive operation but it would ensure all the proper handlers get called.
tableInstance.clear()
Clears the data from the table (the table settings remain intact).
refer to the
doc
All the rows in a particular HBase table that I am making a UI for happen to have the same columns and will have so for the foreseeable future. I would like my html data visualizer application to simply query for a single random row to take note of the column names, and put this list of column names into a variable to refer to throughout the program.
I didn't see any equivalent to find_one or scan_one in the docs for HappyBase.
What is the best way to accomplish this?
This will fetch only the first row:
row = next(table.scan(limit=1))
Additionally you can specify a filter string to avoid retrieving the values, which is only worthwile if your values are large and you're performing this query often.
I use the 'limit' option.
Here is my HappyBase Python code:
pool1 = happybase.ConnectionPool(size=2, host='172.00.00.01')
with pool1.connection() as conn1:
hTable = conn1.table('HBastTableHere')
for rowKey, rowData in hTable.scan( limit=1):
print rowData
You can create a Scanner object, without specifying the start row (so that it start at the first row in the table), and limit the scan to one row. You will get then the first row only.
From the HBase shell command it should look like this:
scan 'table_name', {LIMIT => 1}
I don't know for HappyBase but I think you should be able to do that
I'm using a grid which have editurl: "clientArray",datatype: 'xmlstring', datastr: '<%=_xml_string %>'.
I have a button in my page , and when i click it i make an ajax call and get an xml containing new rows that i want to add to my grid.
Currently i'm looping through the xml rows and using addRowData for each row.
My question is how can append these rows to the current grid? I want the rows that are currently in the grid to still be there and append to them the new rows from the xml i get.
Thank's In Advance.
You can for example prepare an array of data with the new rows. You can add all the rows in one call of addRowData (read the documentation for more information about different parameters of addRowData).
The things will be more easy if you would return JSON data from the server instead of XML. It is recommended for the most situations. Then you can just make one call of addRowData with the data returned from the server to append there to the grid. Optionally you can needed to use small customization of the localReader (see here for more information)
depending on the formatting of the returned data, you could use addXMLData, however you may have to manipulate the returned XML first in order to have it format correctly.