Table Filter in NG-ZORRO - angular11

I am using nz-table component of NG-ZORRO in my angular 11 App. I want instant search functionality when user type in the textbox.
Here is UI where I used the nz-table
I know there is column level filter option in NG-ZORRO as per their documentation .
But didn't find the functionality like this what I am looking for.
Any idea if there is way to do this.

You can add the filter property (nzFilterChange) on your th tag. For example :
filterChange(search: string) {
// You can do the job here
}
<th (nzFilterChange)="filterChange($event)">Header</th>

Related

How to add class or attribute to td element while using wenzhixin bootstrap table server side pagination

I am using wenzhixin bootstrap table with server side pagination. My table has two special column(First column for row Guid row id, Second column include two button for each cell)
My problem is, I should hide first column content because I don't want to see all Guid id by Users. Moreover, My table data coming with server side pagination. I couldn't button with html code for second column.
How can I add custom column for server side pagination or how can I add attribute to all cells in the first or second column?
To hide a column, you can use either JavaScript command after the bootstrapTable('load',..) if you used that, or in a document ready block:
$table.bootstrapTable('hideColumn', 'name')
shown on Bootstrap-Table site: bootstrap-table.com: showColumn-hideCoulumn
or if defining within the table, add data-visible="false" to the column you wish to hide.
bootstrap-table.com: column-options visible
i.e.
<table id="table"
data-toggle="table"... >
<thead>
<tr>
<th data-field="id" data-visible="false" >ID</th>
For the buttons - I am not sure what type of project this is for - but I solved this by adding link buttons to the table rows via data-formatter - read up on this on the API documentation bootstrap-table.com/docs/api/column-options/#formatter
I used the examples found on github.com/wenzhixin/bootstrap-table/issues/1765 - under Format -> 'Basic Format' - which shows how to add a link (button via Bootstrap CSS). To make the link specific to a row, use row[] to get a field value, or you can even use the id column instead of hiding it, if that is your field (use 'value' instead of row[] then - see examples).
I did mine something like:
<th data-formatter="buttonFormatter">View Links</th>
then in the javascript <script> block:
function buttonFormatter(value, row, index) {
var id= row["id"];
var url = "https:/...&id=" + id;
return 'View';
}
These are based roughly on stuff I've been doing recently - haven't tested these examples, but should give you a good start if you haven't already figured it out...

Is there a way to get a list of hidden column

I want to save the list of hidden columns so that next time when the table is loaded I show the table with the same set of column which the user chose to see in the past. Is there a way to get a list of all hidden columns in bootstrap-table library.
You can use the cookie extension to solve your problem, here is an example: http://issues.wenzhixin.net.cn/bootstrap-table/#extensions/cookie.html.
The plugin saves:
Sort order
Page number
Page number from the list
Visible columns
Search text
Docs here: http://bootstrap-table.wenzhixin.net.cn/extensions/#table-cookie
you can use the jquery datatables plugin to easily handle this problem, this plugin auto generate the table columns and show that.
you will get more information from link below,
https://www.datatables.net/
hope it helps.
try this below
var tab = $('#table').bootstrapTable('getHiddenColumns');
$.each(tab, function(index, value) {
alert(value.title);
})

Get sub items in umbraco

I have the following structure:
How do I access to Features of current Product in template?
Do you have any sample code? You would probably use the Children property. It would be something like
#foreach(var child in CurrentPage.Children)
{
<span>#child.featureName #*Or whatever field you have on feature*#</span>
}
They put out a cheat sheet which is always handy.

Dart + Polymer, how to bind to programmatically generated elements, textarea, select, optgroup

I'm trying to create a form Polymer component where form elements are generated on the fly. I've looked, and so far the only way to bind the value attribute is by using .injectBoundHtml. This does not work with all component types, I'm trying to bind the value of a <textarea>, and this is what I get:
Removing disallowed attribute <TEXTAREA value="{{ results[ "comments" ] }}">
My work around was to add: textareaID.addEventListener('change', updateValueMap)
I'm hoping someone could tell me why value is disallowed, and/or if there is a better way to programmatically assign bound attributes in Polymer. Please :)!
Thanks to Gunter's suggestion, and passing a node validator:
var val = new NodeValidatorBuilder.common()
..allowElement('textarea', attributes:['value']);
this.injectBoundHtml(getElementStr(i), element:selP, validator:val);
Textarea doesn't have a value attribute.
Try this instead
<textarea>{{results['comments']}}</textarea>
For more information about the message Removing disallowed attribute see How to create shadow DOM programmatically in Dart?

Drupal 7: Webform: Set hidden field to some value on radio button selection

I have a Webform which has a Selection List of radio buttons on it.
I would like to set the value of a hidden text field based on radio button selection.
So if user selects 1st option i would like the text field to have "First" as text and like that.
can this be done? I want to eventually use this text field later on for other processing.
I agree with Ben...you should use the value of the select fields themselves using the syntax for the select field Options, ie "safe_key|Some readable option" (without quotes)
So your select field options would have something like:
first|This is some pizza
second|Just the cheese
If you like, since you want the value "First", you can even capitalize the keys, ie:
First|This is some pizza
Second|Just the cheese
However, if you insist on having the select field change the hidden field's value and you want to do this purely through Drupal 7 front-end, then I suggest the following:
Install the following module:
Code per Node - allows you to add custom CSS/JS to content types or individual nodes
Update your content type settings (ie. by content types or individual nodes)
Then, write some jQuery or JS to do what you want on the node that is housing your webform...ie:
Some Javascript::jQuery for what you want:
jQuery( "#my-select-field" )
.change(function () {
var str = jQuery(this).text();
jQuery( "my-hidden-field" ).val( str );
})
.change();
The ".change()" call at the end is to trigger a change event so that your hidden field is always populated with the appropriate data...
Be sure to put your code in a "jQuery( document ).ready(function() { ... }" call so that the bind is made at the right moment and so your page has finished loading.
*Note: In Drupal 7, the core jQuery Library is referenced by "jQuery", not the "$" alias
You can create a module that implements a submit function. So if your module is "specialFormProcessing" you would create the function:
function specialFormProcessing_mySubmitFunction($form, &$form_state) {
}
Within that function, you would set the value of the hidden field from the SELECT box.
You should also add your function to the array of functions that will process the form. There will be yours and the form's original submit function (depending upon what the form is), and maybe others that other modules have implemented. You do this by creating a hook_form_alter() function in your module:
function specialFormProcessing_form_submit(&$form, &$form_state, $form_id) {
}
You use the $form_id to make sure you are working on the correct form, then do something like:
$form['#submit'][]='specialFormProcessing_mySubmitFunction';
I found the book "Pro Drupal Development" by VanDyk very helpful when I was learning Drupal and manipulating Forms. I was using Drupal 6, but he has a newer edition for Drupal 7. There are criticisms that it doesn't deal with some of the new Drupal 7 features, but its treatment of Forms should be good.

Resources