tablesorter child row searching - tablesorter

I am using tablesorter with child rows. My table has many many child rows per parent row. All child rows have same number of columns as that of parent.
I have filters implemented, with which I can search both parent and child. When I do a search in the filter box for a column, I notice that all filter matches from all columns a child row are also reported. The intend in my application is to report matches for a specific column (same column of filter box) regardless of whether it is a parent or a child.
Has anybody came across this before ?
For example, look at this site
http://mottie.github.io/tablesorter/docs/example-child-rows-filtered.html
If we search for "Colorado" in the "Date" column filter box, one entry will still show up, which has the string "Colorado" in some some unrelated column in the child row.

I have the same problem. The way we overcame was basically to make childrow have its own specific columns and then add external filters only on those columns. Then we had to hide the filters in the header for columns with child column data. Not sure if this has been fixed.
<tr class="tablesorter-childRow">
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td>child column filter 1</td>
<td class="filter-match">Child column fiter 2</td>
<td class="filter-match">child column filter 3</td>
</tr>

Related

Sticky columns for dynamic colum definition

I am trying to define an Angular Material table with approx 24 columns and they are not uniform in behavior. Some columns just display text, others may have controls. I want to try and keep it as dynamic as possible and not have them all defined in the HTML file.
I have created an object to define a column object and create the columns dynamically:
<ng-container *ngFor="let column of columnDefinitions" [matColumnDef]="column.columnName">
<th mat-header-cell
*matHeaderCellDef
mat-sort-header
[disabled]="!column.sortable"> {{ column.label }} </th>
<td mat-cell *matCellDef="let row"
[ngClass]="getClasses(row, column)"> {{ getColumnContentFor(row, column.columnPath) }} </td>
</ng-container>
Some of the questions I have are around how to best add functionality based on the type of column I need:
I want to add a sticky column just to the first couple of columns
Ideally even the [ngClass] would like it only for certain columns so it doesn't have to evaluate this function for every column.
If some columns have a custom control how can I add a custom template
Any examples you may suggest would be extremely helpful.
You can do this by adding the index to ngFor, like this: *ngFor="let column of columnDefinitions; let i = index". Then, you can conditionally add the sticky position by adding this to the th cell: [style.position]="i < 2 ? 'sticky' : null" (null value means that the style won't be added).
EDIT: You also need to change the matHeaderRowDef to *matHeaderRowDef="columnsToDisplay; sticky: true"
While you can use something like ngSwitch for that, I don't think it's worth the effort. You can, however, make sure you return null as early as possible for classes that don't need it.
Inside the td element, you can use ngSwitch, as described here. You can use the column index, for example.

How to count total number of results return by list and display

I am using MVC 4.
I binding result in grid based on my search criteria in web grid. and i am showing 10 records per page.
the question is.
How can i show the total count of records below the grid.
i tried counting the result list in control and show it in view.
if i use
#Html.TextBoxFor(m => m.NumberOfRows)
it returns result in the text box
but if i use label means if shows property name instead of total count.
#Html.LabelFor(m => m.NumberOfRows)
Why label show property name. How can i show the total count. or is it possible to show the total count in web grid itself?
please help.
LabelFor() in MVC is used to display model property names,so instead using LabelFor(),if you are binding value to NumberOfRows from controller action then
Instead of
#Html.LabelFor(m => m.NumberOfRows)
Try
#Model.NumberOfRows

Filter pivot table conditionally

I need to make a pivot table of sales by cities. How can I filter it such that for Toronto and Montreal it will show sales > 50K and for other cities sales > 25K?
You'll need to adjust your source data to include a new column for "filtered" values. That column will have a formula to include your criteria. For example:
=if([city name]="Toronto",if([value]>50000,[value],if([value]>25000,[value],0)),0)
Then in the pivot table you use the new 'filtered value' column and filter out anything that is 0.

How to insert plain text?

I have some xml text to be inserted in the document as plain text. I directly inserted but it gives weird symbols. How can I avoid that?
XML I want to add:
\begin{tabular}{|c|}
<table>
<tr>
<td> Title and Logo</td>
</tr>
<tr>
<td> left Column </td>
<td> main table </td>
</tr>
</table>
\end{tabular}
And the output is like :
¡table¿ ¡tr¿ ¡td¿ Title and Logo¡/td¿ ¡/tr¿ ¡tr¿ ¡td¿ left Column ¡/td¿ ¡td¿ main table ¡/td¿ ¡/tr¿ ¡/table
Basically I want to add the HTML code in a tabular. How can I do that?
Have you tried the verbatim environment?
\begin{verbatim}
Your text here.
\end{verbatim}
Without knowing what your "weird symbols" are, it's difficult to suggest a solution to your problem.
Update: In order to embed a verbatim environment in a table cell, you need to change the column to a paragraph column (using either p, m, or b as the column specifier); e.g.
\begin{tabular}{|p{10cm}|}
\begin{verbatim}
Your text here.
\end{verbatim}
\end{tabular}
See Wikibooks for more information.

Grails each tag with iteration

Hey. How can i have a variable in each tag to be an iterator (for example, first time run cycle takes value=1, second time value=2, and so on..
The status attribute is what you are looking for. See below:
<g:each collection=${books} var="abook" status="i">
${i}
</g:each>
if you call ${i} inside the each tag it will return the current iteration count.
Assuming the books collection contains 5 books, the output will be:
0
1
2
3
4

Resources