Set focus on column - Ag Grid React - ag-grid

When we have 200 Columns in an Ag-grid and the user wants to look for a particular column, normally it is done by scrolling and looking for that column but having 200+ columns is going to be annoying.
So we need to develop and search box to search for the column name we scroll and set focus on the given column.
What I have tried
The following code does focus but only on visible columns, if I have to focus on the 100th Column it doesn't work
gridRef.current.api.setFocusedCell(0,gridRef.current.columnApi.columnModel.getAllDisplayedColumns()[10]);

You can use the below method ensureColumnVisibleto make sure the column is visible.
const allColumns = params.columnApi.getAllColumns();
console.log(allColumns);
params.api.ensureColumnVisible(allColumns[allColumns.length - 1].colId); // <- changed here
forked stackblitz

Related

Implement a GridView.Count with non scrollable first row and column

So I am implementing sort of a data table in flutter. it shows data based on time in days in rows and some other variant in columns. so naturally, first row is name of the days, and then in first column are values of the other variant. What properties of GridView.count can I use to make first row and column stay fixed when scrolling the grid. so that you can always see the data variants in screen.
I have gone over all properties of GridView.count but I can't find anything.
PS: I don't want to change to something else Like GridView.builder..... because the code is too far gone with how it renders the dynamic data in the rest of rows and columns.
Please Use data table instead of Grid
https://api.flutter.dev/flutter/material/DataTable-class.html.

Adjust column width in Nattable - show complete column name when selected

I need to display complete column header name, when column is selected, it means increase column width. And reset width when column is deselected. I did not find example in nattable_examples.exe. Is there some built in feature?
No there is no built-in feature that would support automatic increase/decrease of column widths on selection. You will need to implement some selection listener and then do an auto-resize on the selected column by using the AutoResizeColumnsCommand.
But I don't think we have an event on deselect, so I am not sure how you want to reduce the column width again.

Display two fields in one line and one just if necessary

I created a standard report with jaspersoft studio.
I want to display two fields in one column (which works already). The second field in the column should just be displayed if it has data (which works too). But It seems that if the second field is not displayed it still takes up space. Or at least the first field isn't vertically aligned in the middle.
I put both in a frame and made them float. Any ideas how to make it align in the middle in the third screenshot?
As Alex K pointed out I just copied the first textfield again and put It over the old frame. When there is no data in the second field I hide the frame and show the textfield. When there is data in the second field I hide the textfield and show the frame.

How to auto center the table after hiding few columns in jasper report

I have been hiding my columns in the table based on the columns I want to hide by passing parameters boolean value to false. It is all working fine, but the problem is when I hide the columns the whole table look likes it has moved to the left and it appears even more weird when I try hide 3 or more columns. I some how need to figure it out and bring the table to the center of the containner after hiding the columns that needs to be hidden. I not able to find any properties to make this change in jaspersoft. Please help me do this.
MY TABLE WITHOUT HIDING
AFTER HIDING THE COLUMNS
How could I make my table center align to the container of that respective band

How to populate the value of a Text Box based on the value in a Combo Box in MS Access 2007?

I have a combo box which is of a lookup type, i.e., I've selected the source to be a column from a table and am storing the selected value in another table. The table which I am looking up has another column and I need the value in this column to be displayed in a text box and each time I change the value in the combo box, I need the corresponding value to be displayed in the text box. How can I do this? What I have done so far is to write a Select query that selects the appropriate column based on the combo box's value. Is there a more decent way of doing this? Please help me!
Make the source of the combo box to your 2 fields e.g. SELECT id, name FROM Customers
Make sure you set the Column Count property of the combo to 2, accordingly.
Then make you unbound text box source equal to =MyCombo.Column(1) (from memory, this Column is zero based).
That's it, zero code required.
It's nicer to use an event of the combo box e.g. onChange, so when a selection is made the event sets the value of the text box.
me!txtTextBox1 = me!cboComboBox1.column(1)
That way it will work everytime.
You could also use a button with onClick etc. but the choice is yours (and as mentioned in the previous post, alter the column number based on its row source with 0 being the first.
After reading the question and answers I tried the following, and it seems to work well (so far):
In order to display more than one column of a combobox selection, I have resorted to the following:
Place a textbox over the combobox,
Size it by sampling other fields, so that it covers the text frame of the combobox.
I have purposely have left a small space to the right of the NEW textbox to indicate that it
Is NOT part of the combobox.
In the Control Source for the textbox enter the expression below:
=[DefaultAcct].[Column](1) & " " & [DefaultAcct].[Column](2)
Then, in the ‘onchange’ event of the combobox, set focus to the textbox.
Private Sub DefaultAcct_Change()
txtConcatenate1.SetFocus
End Sub