Datatabel Search (or filter?) by index and redraw - datatables

i know how to search for a value programmatically and redraw the DataTable so that it shows only rows containing the given value.
I do that like so:
this.api().search('8000').draw();
But now i have the need to do the same but not use a value this time, but show only the row with the given id.
Each row in the DataTable has an id like so:
<tr id="198">
<td>8000</td><td>turnover</td>
</tr>
I know the index of the row with id 198 via:
var rowIndex = this.api().row('#198');
But how to get the DataTable to only show the row with that index?
Via Google i saw people that would place the id in a separate column and use search for that, but i think there must be a more efficient and better way as every row already has an id and i know the index of the row that i want to show.
Maybe it's simple but I googled a long time, tried lots but none of 'em worked.
Any help or pointers are greatly appreciated, many thanks.

Related

How can I duplicate a row right below where it is on DataTables?

I found that DataTables now supports colspan and rowspan. but to use it better, I needed to duplicate same data thrice. What I need to make is something as image below, and I can't find whether DataTables supports splitting a row into multiple rows.
The image shows how I modify each set of data. It means, there will be 5 columns for each data, and it will be split into 3 lines.
Even the question was about duplicating, if there's other way to make a row/set of row for each data with same shape as image, than please explain.
Ok, I found very wierd trick.
I just made display:none to original table, and only showed child row table.
Not like original table, child row was free to custom the format.
The answer of other question on the link was useful.
https://stackoverflow.com/a/72745607/10780764

Eclipse Scout Neon row index in form data

I would like to know how to get row index from form data of the table field.
I would like to get row index from MyTableRowData and I can't find function for this.
Internally, the list of rows is stored as a List<AbstractTableRowData>.
When you invoke the method getRows() on an AbstractTableFieldBeanData, you get an array that is ordered in the same way as the corresponding list.
There is yet another method rowAt(int i) that gets you the row at index i.
The individual row data object, however, does not know its row index.
You may want to explain your use case. This could help to help you :-)

Excel - If Table A1:A100 contains a value of A101:A200, then delete row

I have to admit, that I am fairly new to excel and this community.
However, I did try to program a makro what can manage to delete rows in a specific range if a value below matches the one above. (e.g. A1:A100 if it matches a value listet in A101:A200), because the "delete duplicates" tool doesn't seem to work.
Maybe you guys can give me a good answer / macro-code, which can perfon this kind of action.
greetings, valerius21
OK, your 1st comment substantively changes the question. It's not that Remove Duplicates doesn't work - you're not actually trying to remove duplicate values - you're trying to remove items from one list where the Client ID is in the other list.
In a new column of the list you want to delete FROM, use the VLookup function to find matching values from the other list. Then, use the Filter feature to find all of the matching value rows (the ones whose value you were able to successfully look up) and delete those.

WebDriver - locate dynamic column

I am using webdriver to test our application that contain table where the user can change the order of columns in a table,and also can remove/add columns (This is beside new column added by developers).
What is the right way to find the column I need?
One way is to go over the table header to find the column I am looking for so I have the column index and than I can access the right cell.
Is there other way ?
What about put unique id/class name for every element in table ?
Thanks
You can do two things for this situation:
Get handle to table element, and then navigate accordingly to get the columns or rows. Once you have this, then you can do all operations on them like click() etc.
Other way is, see the pattern of their ids/css because, most of the table that I have deal with will be having ids like this:
grid_name_1
grid_name_2
grid_name_3
Then you can have do this way:
String baseLocator = "grid_name_" + clickedRowIndex;
driver.findElement(By.id(baseLocator)).click(); //for click operation
Lets say user wants to click on the 3rd row, then clickedRowIndex will be 3 which selects the 3rd table row.

Create DataTable child row without showing it?

I am using datatable (v1.10.2 with jquery 1.9.2) because I like the out-of-the-box features (searching/sorting etc). However, now I want the ability to:
1) use animations (sliding) when showing/hiding a row
2) have the hidden row available in the DOM to change (ie, it would exist but have a display:none).
My current code to create the table looks like the following (where formatChild() returns html for a table):
if (row.child.isShown()){
row.child.hide();
tr.removeClass('shown');
} else {
row = row.child(formatChild());
row.show();
tr.addClass('shown');
}
I am using several services to change data in the child row's table via ajax and want to be able to change that data even when the row is hidden. I know I can create a map in memory and use the information in the stored map when I show the child row, but to me it is much cleaner to change the hidden row immediately.
I was hoping I could do a row()child(), modify the row, then call row()child().show() but the row isn't created in the DOM after the row.child().
Regarding the animation, I found an answer here but it involves changing the datatables code :(
I considered just using jquery to add a row to the datatable and hide it, but I couldn't find a good way to "attach" it to the primary row for sorting.
The plan I am currently leaning towards is to add a div to my primary table row that I will show/hide/update rather than using child rows at all.
What is the best practice for managing these hidden areas in a datatable (and showing them with animation)? ty
In case anyone else has the same question, I ended up using a DIV in the row rather than using DataTables' child row. When I add a new row to the datatable, the div is hidden then I hide and show (slideup/slidedown) on a click event. This gives me the nice animations, keeps the sorting simple, and let's me change information in the hidden row. Interestingly, the DIV contains a table and the text that is in that table when I create the new row is searchable; however, the text in the table that my ajax call adds/modifies is not searchable. I'm looking into how I want that to work (and may keep the div out of the search altogether if possible).