I have tried to show pResizableColumn pFrozenColumn into a single table.But after integrate both into single table Frozen Headers also scrolling along with unfrozen columns.
<p-table
[value]="customers"
scrollDirection="both"
[scrollable]="true"
scrollHeight="400px"
styleClass="p-datatable-gridlines"
[resizableColumns]="true"
>
<ng-template pTemplate="header">
<tr>
<th style="width:200px" pResizableColumn pFrozenColumn>Name</th>
<th style="width:100px" pResizableColumn pFrozenColumn>Id</th>
<th style="width:200px" pResizableColumn pFrozenColumn>Country</th>
<th style="width:200px" pResizableColumn>Date</th>
<th style="width:200px" pResizableColumn>Company</th>
<th style="width:200px" pResizableColumn>Status</th>
<th style="width:200px" pResizableColumn>Activity</th>
<th style="width:200px" pResizableColumn>Status</th>
<th style="width:200px" pResizableColumn>Activity</th>
<th style="width:200px" pResizableColumn>Representative</th>
</tr>
</ng-template>
<ng-template pTemplate="body" let-customer>
<tr>
<td style="width:200px" pFrozenColumn>{{ customer.name }}</td>
<td style="width:100px" pFrozenColumn>{{ customer.id }}</td>
<td style="width:200px" pFrozenColumn>{{ customer.country.name }}</td>
<td style="width:200px">{{ customer.date }}</td>
<td style="width:200px">{{ customer.company }}</td>
<td style="width:200px">{{ customer.status }}</td>
<td style="width:200px">{{ customer.activity }}</td>
<td style="width:200px">{{ customer.status }}</td>
<td style="width:200px">{{ customer.activity }}</td>
<td style="width:200px">{{ customer.representative.name }}</td>
</tr>
</ng-template>
</p-table>
I want to export order and order item data in my laravel web app in xls format so i decided to try using maatwebsite/excel v3.1. I'm using FromView class to convert blade template into an excel file, the blade structure looks like this:
<table>
<thead>
<tr>
<th> Order# </th>
<th> Customer </th>
<th> Order Date </th>
<th> Total </th>
</tr>
</thead>
<tbody>
<tr>
<td> 1132 </td>
<td> Ashin </td>
<td> 21-11-2021 </td>
<td> 3000.00$ </td>
</tr>
</tbody>
</table>
<table>
<thead>
<tr>
<th colspan="4"> Order Items </th>
</tr>
<tr>
<th> Product </th>
<th> Price </th>
<th> Qty </th>
<th> Subtotal </th>
</tr>
</thead>
<tbody>
<tr>
<td> Bag </td>
<td> 1200.00$ </td>
<td> 2 </td>
<td> 2400.00$ </td>
</tr>
<tr>
<td> Hat </td>
<td> 600.00$ </td>
<td> 1 </td>
<td> 600.00$ </td>
</tr>
</tbody>
</table>
and the results looks like this:
there is a row gap between these two tables, how can i remove it?
I'm trying to create a custom table button using Jodit React Editor using this as reference - https://xdsoft.net/jodit/examples/toolbar/custom_button.html
I'm a little lost on this though.
I need to be able to create a table and have the icon be a text icon that says - "Table"
Right now I've added this to my configurations - extraButtons: ['tableNew'].
I've also added the below code to the render method.
this.jodit.options.controls.tableNew = {
iconURL: '',
exec: function (editor) {
return '<table> <thead> <tr> <th> Sl no </th> <th>Name</th> <th>Age</th> </tr> </thead>'+
' <tbody> <tr> <td>1</td> <td></td> <td></td> </tr> </tbody> </table>';
}
};
I see that a space has been added in the toolbar which on hover says tableNew but on clicking it nothing happens.
I'd really appreciate it if someone could help me out with this.
Instead of the following,
return '<table> <thead> <tr> <th> Sl no </th> <th>Name</th> <th>Age</th> </tr> </thead> <tbody> <tr> <td>1</td> <td></td> <td></td> </tr> </tbody> </table>';
try something like this:
return editor.create.fromHTML('<table> <thead> <tr> <th> Sl no </th> <th>Name</th> <th>Age</th> </tr> </thead> <tbody> <tr> <td>1</td> <td></td> <td></td> </tr> </tbody> </table>');
This works for me (a similiar implementation, not returning table like you, but return some list).
I am using python3.6 with XPath library. Crawling inside the table gives me an empty list. And need to crawl to specific th.
My tr contents are dynamically generated. I need to crawl to tr which has a specific th value. Example In HTML code, the Rank appears in the second tr but it can appear in anywhere in tr. It doesn't have a specific index. Need to get the href from the tr having the Rank th.
My html file:
<tbody>
<tr>
<th class="a-color-secondary a-size-base prodDetSectionEntry">
Product Number
</th>
<td class="a-size-base">
B003NR57BY
</td>
</tr>
<tr>
<th class="a-color-secondary a-size-base prodDetSectionEntry">
Rank
</th>
<td>
<span>
<span>#3 in Computer Mice</span>
<br>
</span>
</td>
</tr>
<tr>
<th class="a-color-secondary a-size-base prodDetSectionEntry">
Created Date
</th>
<td class="a-size-base">
June 7, 2010
</td>
</tr>
</tbody>
</table>
Python code:
listings_details = parser.xpath(XPATH_PRODUCT_DETAILS)
for row in listings_details:
th = row.xpath("./th/text()")
if th[0].strip() == 'Rank':
categories = row.xpath("./td/span/span//text()")
qid_url= row.xpath("./td/span/span//#href")
I expect the output to be
Rank: 3,
url : /gp/bestsellers/pc/11036491/ref=pd_zg_hrsr_pc_1_1_last,
category: Computer Mice
Need to get the href from the tr having the Rank th.
Use:
/table/tbody/tr[normalize-space(th)='Rank']/td//a/#href
Note: this works for your provided fragment (now well-formed). You need to add later a context for selecting the table element.
<table>
<tbody>
<tr>
<th class="a-color-secondary a-size-base prodDetSectionEntry">Product Number</th>
<td class="a-size-base">B003NR57BY</td>
</tr>
<tr>
<th class="a-color-secondary a-size-base prodDetSectionEntry">Rank</th>
<td>
<span>
<span>#3 in
Computer Mice
</span>
<br/>
</span>
</td>
</tr>
<tr>
<th class="a-color-secondary a-size-base prodDetSectionEntry">Created Date</th>
<td class="a-size-base">June 7, 2010</td>
</tr>
</tbody>
</table>
Test in http://www.xpathtester.com/xpath/53808ee94dfbc5b38f12791cf857ffb9
a=np.array([[1,1,1,1],[2,2,2,2],[3,3,3,3]])
df=pandas.DataFrame(a)
df.to_html('table.html')
I am trying to make pandas.DataFrame to html.
The data are from csv.file, and i split it to several table.
i want make table are in one file one by one.(it's not linked together)
open(filename, mode):
it likes file open with mode 'a',no overwrite original file.
Sample output table like this.
How can i do that or are there another more readable way ?
You can proceed as follows:
put all your dataframes in a list
iterate through them and convert each one to HTML
concatenate all the HTML outputs to one single file
In terms of code, here's how you can do that:
a=np.array([[1,1,1,1],[2,2,2,2],[3,3,3,3]])
b=np.array([[1,4,5,1],[12,2,32,2],[3,32,30,3]])
df_a = pd.DataFrame(a)
df_b = pd.DataFrame(b)
list_df = [df_a, df_b]
output = ""
for index, df in enumerate(list_df):
output += df.to_html() + '<br>'
with open('output.html', 'w') as f:
f.writelines(output)
Here's how the ouput looks like:
<table border="1" class="dataframe">
<thead>
<tr style="text-align: right;">
<th></th>
<th>0</th>
<th>1</th>
<th>2</th>
<th>3</th>
</tr>
</thead>
<tbody>
<tr>
<th>0</th>
<td>1</td>
<td>1</td>
<td>1</td>
<td>1</td>
</tr>
<tr>
<th>1</th>
<td>2</td>
<td>2</td>
<td>2</td>
<td>2</td>
</tr>
<tr>
<th>2</th>
<td>3</td>
<td>3</td>
<td>3</td>
<td>3</td>
</tr>
</tbody>
</table><br><table border="1" class="dataframe">
<thead>
<tr style="text-align: right;">
<th></th>
<th>0</th>
<th>1</th>
<th>2</th>
<th>3</th>
</tr>
</thead>
<tbody>
<tr>
<th>0</th>
<td>1</td>
<td>4</td>
<td>5</td>
<td>1</td>
</tr>
<tr>
<th>1</th>
<td>12</td>
<td>2</td>
<td>32</td>
<td>2</td>
</tr>
<tr>
<th>2</th>
<td>3</td>
<td>32</td>
<td>30</td>
<td>3</td>
</tr>
</tbody>
</table><br>