I would like to combine the following
this table sorter
and this fusion table to html table
But after 3 days of working on it I've decided to may be best to ask for help.
Many thanks in advance.
include the tablesorter script.
Add this to the <table> tag:
<table id="myTable" class="tablesorter">
Add this to the code after the table is populated:
$("#myTable").tablesorter();
working example
Related
Hello i need some help with shopware.
My question is probably pretty basic but i cannot get it done. I want to print out attributes from an article. In shopware documentation they call them {$sArticle.attr1} till {$sArticle.attr20} but they can also have different names so i cannot refer directly to the name and instead i want only a few attributes to be printed.
so far i know that all attributes are stored in the s_articles_attributes database table and i only want to print out those columns when the column name containes='artikelattribut_'
The code is going to be implemented in a table from frontend/detail/tabs --> description.tpl
the actual table already uses the $sArticle.sProperties and the code looks the following:
{if $sArticle.sProperties}
<div class="product--properties panel has--border">
<table class="product--properties-table">
{foreach $sArticle.sProperties as $sProperty}
<tr class="product--properties-row">
{* Property label *}
{block name='frontend_detail_description_properties_label'}
<td class="product--properties-label is--bold">{$sProperty.name|escape}:</td>
{/block}
{* Property content *}
{block name='frontend_detail_description_properties_content'}
<td class="product--properties-value">{$sProperty.value|escape}</td>
{/block}
</tr>
{/foreach}
</table>
</div>
{/if}
The thing is that $sArticle.sProperties and {$sArticle.attr1} till {$sArticle.attr20} are different. All i want is a second {foreach} that loops threw all article attributes maybe the idea is getting clear with that:
{foreach $sArticle.attr FROM s_articles_attributes WHERE name contains='artikelattribut_'}
I hope somebody understands my problem. Thankfull for any advice.
Thanks
First, keep in mind, that "properties" and "attributes" mean something different in Shopware as you might know it from other shop systems.
"Properties" are used for characteristics of a product, like the taste or colour of product.
"Attributes" in Shopware do not have anything to do with attributes in the usual meaning. You can find those *_attributes tables for almost every entity and they are used more like custom fields or columns which you could add to the entities to extend them with custom data.
Now back to your problem. Try this:
{foreach $sArticle.attributes.core->toArray() as $attributeName => $attribute}
{$attributeName|var_dump}
{$attribute|var_dump}
{/foreach}
There are two ways to access the attributes of a product.
All attributes are directly assigned to the $sArticle variable and you can use them, as you already described in your text.
Attributes are also stored in $sArticle.attributes where you can find different types of attributes. By default those are core and marketing for products on the detail page. Be aware that the values of those keys are objects of type Shopware\Bundle\StoreFrontBundle\Struct\Attribute. That's why we need to call the toArray method, to get an array which we can iterate.
I have list for which data is coming as below (3 elements with status as ABC and 2 elements with status as PQR). I am able to display data in table format using forEach.
a:test1:test2:ABC
a:test1:test2:PQR
a:test1:test2:ABC
a:test1:test2:PQR
a:test1:test2:ABC
I want to segregate/filter out the elements of list based on status field(PQR/ABC) and display in different table. Code for display all data in single table in jsp file as below:
<dsp:droplet name="/atg/dynamo/droplet/ForEach">
<dsp:param name="array" param="testData" />
<dsp:oparam name="empty">
No data.
</dsp:oparam>
<dsp:oparam name="outputStart">
Here is the list of data displayed in table format: <br/>
</dsp:oparam>
<table style="width:100%">
<tr>
<th>data1</th>
<th>data2</th>
<th>data3</th>
<th>status</th>
</tr>
<dsp:oparam name="output">
<tr>
<td>dsp:valueof param="element.data1"/>/</td>
<td>dsp:valueof param="element.data2"/></td>
<td>dsp:valueof param="element.data3"/></td>
<td>dsp:valueof param="element.status"/></td>
</tr>
</dsp:oparam>
</dsp:droplet>
There are multiple ways to achieve this task.
You can use two different lists in FormHandler and in JSP iterate it when you need to show.
You can create one droplet and pass this array to the droplet. In droplet, you can create two different lists or segregate/filter out logic and use accordingly in JSP.
Hope this help.
In facebook format references https://developers.facebook.com/docs/instant-articles/reference nothing is mentioned about adding tables. When I try to add tables inside tags that is getting truncated by facebook. Is there anyone resolved this issue?
Thanks in advance for the help.
Tables are not supported out of the box. You can wrap them in an op-interactive though. They won't inherit any styling so you might need to add some styling as well.
<figure class="op-interactive">
<iframe>
<table>
[...]
</table>
</iframe>
</figure>
I've been working with Knockout.js for some time now but only recently I've started to integrate jqueryUI animations for the sake of a better user experience. I'm seeing some issues trying to use the animation bindings on the tr elements inside a table tag. When I use the "visible" binding to hide and show each element it works just fine but when I attempt to animate the showing hiding of each element it only seems to apply to the first row in the table. I've attempted this using various methods. I've attempted using the knockout foreach template 'afterAdd' option as described here:
http://knockoutjs.com/documentation/foreach-binding.html#note_5_postprocessing_or_animating_the_generated_dom_elements
I've also created a custom binding and attempted to use that on each of the table row items with the same results.
Lastly I attempted to use the plugin found here:
http://www.codecoding.com/knockout-plugin-visibility-bindings-with-jqueryui-effects/
And again, it only appears to work on the first element of the table. Now before attempting to rewrite my HTML to use divs and spans rather than the tables I wanted to see if anybody else has seen these sorts of issues with knockout in the past. The relevant chunk of HTML is this:
<table class="tab_table table_a">
<tbody data-bind="foreach:featuredMenuItems,visible:showFeatured">
<tr data-bind="fadeVisible:readyToShow, click:function(){$root.showProductOptions($data);}">
<td class="td_large" data-bind="css:{td_select:itemInCart};"><span class="inCart_delete" data-bind="css:{display_IB:itemInCart},click:removeFromCart,clickBubble:false"><i class="fa fa-times-circle"></i></span><span data-bind="text:name"></span></td>
<td class="td_last" data-bind="css:{td_select:itemInCart},text:lineItemCost"></td>
</tr>
</tbody>
</table>
I would paste the ViewModel code in here as well but it is a rather large view model and the relevant part to this is just a simple "readyToShow" observable set to either true or false. Whenever this table is being shown the "readyToShow" values of each of the objects in the observableArray containing the table items is being set to true over time using a timeout so as to show a cascading effect when the table is shown.
I would really appreciate any help you guys could provide. Thanks!
Earlier Prawn gem allowed to create a table by its html representation (having an html table string as an input argument like <table class="abc"> .... </table>). Now I didn't find this facility in the manual.
So is it possible now? If not, is there any other option then?
TL;DR: if your use-case is 1) generating both HTML and PDF data (like online invoices etc.), and 2) making sure both look the same, then Prawn is not really the best solution (which is the same suggestion in the Prawn Readme).
In your case, you could parse the HTML using Nokogiri or Upton and extract the data from the HTML table and then use it to generate the PDF representation via Prawn. The HTML styles may not directly translate into the ones used by Prawn and so, even with a lot of code-wrangling, you might not achieve the consistency in styling — which I assume, from the comments on the answer by royalGhost, is the result you want. Also, a simple Nokogiri parsing solution won't work if your HTML table is nested and the parsing code does not cater to that. For example, consider this:
<table>
<tr>
<td>First Column, First Row</td>
<td>Second Column, First Row</td>
</tr>
<tr>
<table>
<tr>
<td>First Column, Second Row</td>
<td>Second Column, Second Row</td>
<td>Third Column, Second Row</td>
</tr>
</table>
</tr>
</table>
Then, in the Ruby parsing snippet, you should ensure that the inner <table>...</table> is parsed into a Prawn::Table object and not a row of Prawn::Table::Cell objects.
Any wkhtmltopdf based options such as WickedPDF or PDFKit offer much cleaner way of achieving the HTML to PDF conversion solution.
You have two options:
Ditch Prawn entirely and prefer the solution above.
Use Prawn by extracting the data from the HTML via Nokogiri/Upton and generate the PDF and not worry about styling being the same as that in the HTML representation.
Well you can use prawnto gem for templates to create table using prawn.
For e.g if you define the following templates, it will draw table with 3 columns with x, y and z width.
data = [ ["Column 1", "Column 2", "Column 3"] ]
table(data, :column_widths => [x,y,z], :cell_style => { :inline_format => true })