How to group mat-radio-button row wise in angular material tabel - html

Normally angular material table groups radio buttons column wise, How can I achieve row wise grouping?

As per the angular material documentation on radio groups it states that
Radio-buttons should typically be placed inside of an
<mat-radio-group> unless the DOM structure would make that
impossible (e.g., radio-buttons inside of table cells).
So if you want to have a radio button group per row, then you would just use the name property to group these controls together (exactly how you would for an HTML input type="radio").
<tr>
<td></td>
<td>
<p>Escalation Teams</p>
</td>
<td>
<mat-radio-button value="1" name="escalationTeam"></mat-radio-button>
</td>
<td>
<mat-radio-button value="2" name="escalationTeam"></mat-radio-button>
</td>
</tr>
See my Stackblitz example as shown below:
Notice how for each row you can only check one radio at a time

I don't understand what you want to do. Do you want a column of radio buttons in a single table cell, or multiple rows each with a single radio button in the same column (this doesn't seem likely)? The image shows radio buttons in separate data columns in the same row. You can't have multiple data columns appear in a single view column and and row, so you would need a single data column contain the selected option, and the view for that cell to lay out the various radio options in a vertical format. Here is a stackblitz example.

Related

how to iterate a collection in a html table with limited (n) columns in a row using thymeleaf

I am new to front end and using thymeleaf. I am looking for an approach to build a dynamic form. I am sending a map from controller to front end (html), I am able to display the values of my map using below code with thymeleaf attributes
<tr class="row" th:each="element : ${elementMap}">
<td th:text="${element.key}"></td>
<td>
<input type="text" id=${element.keyth:name=${element.key} th:value="${element.value}" /><br>
</td>
</tr>
I need to display 4 columns in a row. Or If converting above Map to ArrayList is it possible to allow 4 columns in a row. But when I use th:each && th:text for iterating content of Arraylist how to mention 4 columns in a row (Any css style would be available)? Is there any other approach available to fix this ?
on your page you are iterating one line for each element
the columns are the td tags, which according to the code you informed are two columns per line (key and value).
but if you want to limit the number of columns, you can use css, but by the structure of your code, you have dynamic lines (1 line for each element of the list) and you only have two columns per line.
if the problem is too many columns, you can only put up to 4 td tags

Implement dropdown element in a table cell using HTML?

Just learned some basic forms of HTML and wanted to implement a dropdown menu into a table cell. My code below:
<tr>
<th><input type="text" /></th>
<th>
<select>
<option>One</option>
<option>Two</option>
</select>
</th>
</tr>
The input boxes are displayed perfectly, and dropdown only works when I test my snippet in Tryit Editor.
But when built into my REDCap project the dropdown snippet code is only shown as plain standard text? Screenshot attached. Screen | As you can see, input fields also work.
If you want a dropdown menu in REDCap in a table, you will need to build a field that is a dropdown type field and then embed it into your table. You should also do the same with the standard text fields as REDCap will display them but it wont save any data entered into them.
Embed fields by creating them seperately to your table, then ente the variable name into the table in curly brackets {dropdown_field} you can add :icons to show the missing data, history and comment buttons next to the field. Like this {dropdown_field:icons}
<tr> {dropdown_field} </tr>

How to create html table having 8 colums looking as form so the user can enter data from view?

Screent shot is Available in following given screen shot.
I infact want to create the bill in html so user can create bill from view.
How this is possible?
This is very easily doable through bootstrap. Based on the screenshot you provided, you can create the initial 'container' div element within the body. Afterwards you can then create two rows, one for the 'date' 'to' and 'bill no'. This row can have a col-md-3 for the 'date', a col-md-6 for the 'to' and a col-md-3' for the 'bill no'. This will make it responsive and will keep you from ideally having to manually do much padding to get things aligned.
For the table, you can simply add a table element and add a bootstrap class of table, which is 'class="table"'.
Here is a link to the bootstrap grid system for guidance on how to do your rows/columns: http://getbootstrap.com/css/
Here is the link for doing your bootstrap dropdown for the 'to' and the tables: http://getbootstrap.com/components/
You have to insert a textbox inside the cell(column)-
here is the code-
<table>
<tr>
<td><input type="text"></td>
</tr>
</table>
It will insert a textbox inside the cell.

how to align checkboxes to the left of a table in html

I have a table representing data in a database and I'd like there to be checkboxes to the left so that the user can do operations on the selected items (ie delete, modify). My question is, how can I align the checkboxes to be to the left of the table?
<table border="2">
<tr>
<th>A bunch of headers</th>
</tr>
<tr>
<td>A row of items</td>
</tr>
A lot more rows
</table>
Pretty straitforward, I have no idea how to proceed with checkboxes, I tried to put a form around the table but that didn't work.
You can add a column that contains checkboxes only. Using td elements, they will be left-aligned by default.
However, checkboxes should be used to provide a control for selecting or not selecting some parameters, not for triggering actions. Consider using e.g. button elements for actions.
Use CSS to align them.
margin-left:100px;
float:left;
You could just create an "actions" column which you insert as the first column in your table that contains the checkboxes. That way all checkboxes are kept separate from the contents which makes formatting and manipulation via javascript easier.
Alternatively if you must use a form for each row you could do something like:
<td><input type="checkbox" /><span>Data...</span></td>
... but if you go the second route you loose the power of tables** & may as well go for a div only solution.
** for displaying tabular data; before someone shoots me down for table vs div for layouts.

Show/Hide child table(html) on selection radio button in master table

I have requirement where on selecting radio button in the main table a child table has to appear below. Any help?
Thanks for the reply, this is my actual requirement.I have two tables Item attributes and Item attributes values. Onclicking Item attributes (i.e)e.g: ticket height checkbox the child table of ticket height should display. Like wise there will be 10 item attributes and its respective item attribute values. So on clicking each item attribute the child attr value table should display.
Add an id to the child table.
<table id=`childTable`>
...
</table>
Add an onclick handler to the radio button
<input type="radio" name="radShowChild" onclick=showHideChild()>
Add a javascript function to do the hiding
function showHideChild()
{
document.getElementById("childTable").style.visibility = "visible" ? "hidden" : "visible";
}
If you want to display specific "child" tables based on the radio button selected, pass the child table id as a parameter to the showHideChild() function.