I have 2 APEX interactive grids as a master detail on the same page. The top grid (master) has a vertical scroll bar which I want but there are only a few columns in each row and it does not need a horizontal bar.
I had to change the Pagination to scroll from Page and set the heading to region and the height to 400 px so both reports are displayed on one page.
I tried setting body overflow to hide in template options but I still have a big horizontal scroll bar in the middle of my page.
In addition to this, it seems the columns keep resizing themselves to take up all the space even though I made them very small and saved the report. The scroll bar does not really scroll since it has no place to go.
Any help on how to get rid of the scroll bar would be greatly appreciated.
The only way to hide it is for the columns to be smaller so that there is no reason for it to exist(afaik). You say you already resized them and saved the report and it didn't work. I am not sure if it will work but we have this code in the attributes-advanced-javascript initialisation code in one of out environments that seems to do what you want:
function(config) {
// Logically we want to do this: config.views.grid.features.stretchColumns = false;
// but the server may not generate the views, grid, or features objects
// so we must check for and add if needed each one using this code
var o = config;
"views.grid.features".split(".").forEach(function(p) {
if ( !o[p] ) {
o[p] = {};
}
o = o[p];
});
o.stretchColumns = false;
return config;
}
Try it and maybe it will work for you, not a guaranteed answer, but just something to try.
Related
I would like to know how to achieve mouseover on a cell, if a column is too short for full text.
So, if I have column with fix width, and text is too long, how to present whole text with mouseover in a cell.
You can dynamically add a mouse over tooltip on any cell by overriding the
execDecorateCell(Cell view, ITableRow row, IColumn<?> col) method in AbstractTable and setting your tooltip text like
#Override
protected void execDecorateCell(Cell view, ITableRow row, IColumn<?> col) {
super.execDecorateCell(view, row, col);
view.setTooltipText("Hi there: " + view.getText());
}
Unfortunately, this does not consider if your text length exceeds the length of your column/cell. It will set the tooltip text in any case! So far, I am not sure, whether (or how) it is possible to calculate (in pixels?), if the actual string length inside a cell exceeds ones column length. Maybe you could try something, that takes the actual string length into account (java.lang.String.length()) and only provide a tooltip if a certain length is given.
Let me know, if this is works for you!
Best regards,
Matthias
The tooltip for truncated text in a table cell is currently only shown if it is not possible to resize the column. This is done by purpose because the tooltip may be very annoying. The code responsible for this is in the file Table.js:
scout.Table.prototype._isTruncatedCellTooltipEnabled = function(column) {
return !this.headerVisible || column.fixedWidth;
};
If you don't like this behaviour, you could adjust the JavaScript code. There are mainly two ways for doing this:
Replace the original function
Extend the table and override the function
With the first approach you replace the actual function, so everytime a scout.Table gets created this function is used. With the second approach you need to make sure your new table is used. In order to do this you need to specify a mapping between the object type and the constructor which will be used whenever an object should be created using scout.create(objectType). This is normally done by convention, so if you write scout.create('Table') a new scout.Table will be created. Because you now want to create a custom table you need to add the mapping to scout.objectFactories.
For me, the first approach feels more like patching, whereas the second one is a cleaner solution. The advantage of the second solution is that the original object stays untouched and you could, at least theoretically, still create regular tables. That's why I suggest to use the second approach. But in the end it is probably a matter of taste.
In both ways, you need to create one or more JavaScript files, register them in yourproject-module.js and include this module in your index.html. The files could look like this:
Approach 1:
patches.js
scout.Table.prototype._isTruncatedCellTooltipEnabled = function(column) {
return true;
};
Approach 2
CustomTable.js
scout.CustomTable = function() {
scout.CustomTable.parent.call(this);
};
scout.inherits(scout.CustomTable, scout.Table);
/**
* #override
*/
scout.CustomTable.prototype._isTruncatedCellTooltipEnabled = function(column) {
return true;
};
objectFactories.js
scout.objectFactories = $.extend(scout.objectFactories, {
'Table': function() {
return new scout.CustomTable();
}
});
Remember: The scout JavaScript code is not api and may change anytime. You won't get compile errors if the function will be renamed as you are used to with java. So before adding a lot of custom JavaScript code to adjust the default behaviour you should consider opening a bug first so that it can be fixed in Scout. It could help others as well.
In Infragistics Ultra Grid I have to disable a Boolean (Check box) cell based on a condition in Initialize Row event
PS: I don't want entire column to be disabled. Just only cell should be disabled (cell which contains check box should also be disabled).
I kept code like below
e.Row.Activation = Activation.NoEdit
This code is disabling all the cells in ultra grid row. But a Boolean checkbox which is present in a cell is not getting disabled.
try something like:
private void ultraGrid1_InitializeRow(object sender, Infragistics.Win.UltraWinGrid.InitializeRowEventArgs e)
{ // deactivate boolean in cell 0
//ultraGrid1.DisplayLayout.Bands[0].Columns[0].CellActivation =
// Infragistics.Win.UltraWinGrid.Activation.Disabled;
e.Row.Cells[0].Activation = Infragistics.Win.UltraWinGrid.Activation.Disabled;
}
Other choices available beside Disabled are: ActivateOnly, AllowEdit, and NoEdit
You can always come back and activate it.
Here is another idea. Instead of a boolean cell, make it a System.Drawing.Bitmap and create your check boxes, checked, and unchecked.
and then create/modify an image(s) for disabled.
On the cell click event, change the cell image according to your needs. If need be, create an additional hidden column to store the state/value of the cell. This is something I did when I created/translated a Java version of my c# application to run on other platforms and it worked out great. (Feel free to use these images if it helps)
Found the root cause. In base class there is one mouse down event due to which checkbox in ultragrid is being enabled. Even though if i kept logic like this e.Row.Activation = Activation.NoEdit.
Thank you all for your help.
This might seem a very easy problem but I am stuck and can't find a way out of it. I am using ultragrid in my form with several columns. My issue is when I am trying to click on the column header I am expecting my entire column to be selected but it doesn't. I assumed the SelectTypeCol is the property for my column selection but it did not work either. I also tried to add each column to Selected.Columns collection like this UltraGrid1.DisplayLayout.Bands(0).Columns(i).Header.Selected = True but it didn't work for me either. I believe Selected is only available during runtime but not at the design mode.
So if there is an easier way to make this work, please let me know.
Thank you
You are looking for the property HeaderClickAction
grid.DisplayLayout.Override.HeaderClickAction = HeaderClickAction.Select
This will automatically flip the selection state of the entire column as Selected (or Delected) when you click on the header. Of course this means also that you loose the ability to automatically sort on all columns
You can programmatically set the Selection state of a column with code like this (C#)
grid.DisplayLayout.Bands[0].Columns["youColumnKey"].Header.Selected = true;
this will permit to leave the HeaderClickAction property to SortSingle or SortMulti, but you have to handle the situation using code and appropriate events
You need to have an InitializeLayout event on your grid. in this event you need to set the chekboxsynchronization to default and it should work here is sample code
private void ultraGrid1_InitializeLayout(object sender,
Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs e)
{
e.Layout.Bands[0].Columns.Add("CheckBox");
e.Layout.Bands[0].Columns["CheckBox"].Style = ColumnStyle.CheckBox;
e.Layout.Bands[0].Columns["CheckBox"].Header.CheckBoxVisibility = HeaderCheckBoxVisibility.WhenUsingCheckEditor;
e.Layout.Bands[0].Columns["CheckBox"].Header.CheckBoxSynchronization = HeaderCheckBoxSynchronization.Default; <-- make sure it is set to default here
}
I have a QTableView with 80+ columns displayed in it. The subclass i have created for QTableView allows has functionality for the standard table stuff i wanted e.g order by columns move columns and rows hide column and rows etc.
However the problem i have is the view's focus. lets say you have all the data in the table, you scroll all the way to the right so you are looking at columns 70-80 (assuming 10 columns fit on the screen at once) if i click the header of row 80 (to order by column 80) the table reorders (as expected) however it also jumps the view to the last focused cell (which as far as i can tell is the cell that was last clicked)
What i want to do is not necessarily refocus on the column that was clicked because this might still change the view what im looking for is to just keep the view's focus exactly as it is instead of having it jump back to where the last clicked cell was?
Is there some flag im missing for focus policy or will i need to get the current view and set the view back to that view after mouse clicks that reorder the table and if so how could this be done.
Im aware i have provided no code for this question but it doesnt seem there is any needed since its not a bug im looking to fix more of a feature im unaware of, if you want to see any just comment
EDIT:
Im using a QSortFilterPorxyModel, this seems to get set once (when i call this->setSortingEnabled(true); after the initial call to this on contruction my table model never calls sort again. I have a slot linked to the header clicked signal, and i set the scroll bars to scrollTo() to the index clicked, but i think the sort is happening after this so it does nothing, any idea of what signal are emitted after sorting so i can catch them and then set the view back maybe?
thanks
Before you do your sort, store the current values for where the scroll bars are with
int vPos = yourQTableView->verticalScrollBar()->sliderPosition();
int hPos = yourQTableView->horizontalScrollBar()->sliderPosition();
then after the sort, set it back
yourQTableView->verticalScrollBar()->setSliderPosition(vPos);
yourQTableView->horizontalScrollBar()->setSliderPosition(hPos);
The signals you are looking for are signals of QSortFilterProxyModel inherited from QAbstractItemModel:
layoutAboutToBeChanged()
layoutChanged()
I couldn't reproduce your symptoms by creating a QTableWidget, filling it up with random stuff, and then sorting a particular column. The selected cell stays selected, but does not become visible if it has scrolled off screen.
So the question is, what is causing the behavior you're seeing. It sounds as though scrollTo() is being called by some other function. Since that's a virtual function, I would override it with a pass-through function and see when it's getting called.
I feel really silly asking this question but how do you add any data to a Combo Box? Like I want to display A,B and C as my dropbox strings but I have tried out many things, still my Combo Box does not display anything.
I have tried setting the 'Data' property with A;B;C..still it doesn't show this.
I tried this in my Oninitdialog() function:
CComboBox* pComboBox = (CComboBox*)GetDlgItem(IDC_SENSOR_LIST);
CString string;
for(int i=0;i<10; i++)
{
string.Format("String %d", ++i);
pComboBox->AddString(string);
}
..
still no change. It may be I might not be doing something really silly but not able to figure it out at the moment. Kindly help.
Cheers.
Make sure your combobox has a height that can hold all entries. The height of a combo box doesn't affect the combo box itself, but the dropdown list.
You can change it in the dialog editor:
Click on the down arrow of the combo box, now there should be a rectangle that allows you to change the height of the combobox dropdown list. Make it large enough to hold all entries.