What is the best way to display number of rows that an UltraGrid is bound to?
I want to be able to do,
this.UltraGrid.DataSource = myCustomObject;
And, the grid should display the data along with the number of rows.
I tried to write a custom control with an ultragrid and a status bar.
Update the status bar with rowCount when "InitializeRow" event is fired.
This will give me what I want but this is very inefficient.
I have tried other events like "InitializeLayout", "InitializeRowsCollection","Enter" events but when the datasource changes these event doesn't get fired.
Suggestions?
I found a better way to do this by using SummaryDisplayArea feature of ultragrid.
http://help.infragistics.com/Help/NetAdvantage/WinForms/2011.1/CLR2.0/html/Infragistics2.Win.UltraWinGrid.v11.1~Infragistics.Win.UltraWinGrid.UltraGridOverride~SummaryDisplayArea.html
On InitializeLayout event I have something like this
e.Layout.Override.AllowRowSummaries = AllowRowSummaries.True;
UltraGridColumn columnToSummarize = e.Layout.Bands[0].Columns[0];
SummarySettings summary = e.Layout.Bands[0].Summaries.Add("Count", SummaryType.Count, columnToSummarize);
summary.DisplayFormat = "Number of Rows: {0:N0}";
e.Layout.Override.SummaryDisplayArea = SummaryDisplayAreas.BottomFixed;
e.Layout.Override.SummaryDisplayArea |= SummaryDisplayAreas.GroupByRowsFooter;
e.Layout.Override.SummaryDisplayArea |= SummaryDisplayAreas.InGroupByRows;
summary.SummaryDisplayArea = SummaryDisplayAreas.BottomFixed | SummaryDisplayAreas.GroupByRowsFooter;
e.Layout.Override.GroupBySummaryDisplayStyle = GroupBySummaryDisplayStyle.SummaryCells;
e.Layout.Override.SummaryFooterAppearance.FontData.Bold = DefaultableBoolean.True;
e.Layout.Override.SummaryFooterCaptionVisible = DefaultableBoolean.False;
If you use a BindingSource you may like the BindingNavigator.
You can drag it on your form from the Toolbox (data tab) and set its BindingSource property. You can simply remove the add and delete buttons if you wish, which makes it look like this:
Related
I have an interactive grid with a bunch of records, and I want to set up a button on the page that changes one column in all records currently selected.
Running APEX 18.2, the IG has a whole bunch of columns and I want to change just one of them, but on a whole bunch of rows, so I do need a button.
The IG has ROWID as PK because the actual PK is assembled from 4 different columns.
I have spent some time googling this issue and have found a couple people with solutions:
http://thejavaessentials.blogspot.com/2017/03/getting-selected-rows-in-oracle-apex.html
This is the first, and simplest solution. But it doesn't return any rowid or anything like that, it returns the value in the first column.
Then I also found
http://apex-de.blogspot.com/2018/09/update-several-rows-in-tabular-form-grid.html
and
https://ruepprich.wordpress.com/2017/03/23/bulk-updating-interactive-grid-records/
Which are pretty similair and seem to be the best for me, but I get a Javascript error in the console: http://prntscr.com/n5wvqj
And I dont really know much Javascript, so I dont know what went wrong or how to best fix it.
I set up a Dynamic action on button click that executes Javascript and I have the selected element being the region named CUR_STAT.
var record;
//Identify the particular interactive grid
var ig$ = apex.region("CUR_STAT").widget();
//Fetch the model for the interactive grid
var grid = ig$.interactiveGrid("getViews","grid");
//Fetch the model for the interactive grid
var model = ig$.interactiveGrid("getViews","grid").model;
//Fetch selected records
var selectedRecords = apex.region("CUR_STAT").widget().interactiveGrid("getViews","grid").view$.grid("getSelectedRecords");
//Loop through selected records and update value of the AVT_OBR column
for (idx=0; idx < selectedRecords.length; idx++)
{
//Get the record
record = model.getRecord(selectedRecords[idx][0]);
// set Value for column AVT_OBR on "D"
model.setValue(record,"AVT_OBR", 'D');
}
The column named AVT_OBR is a select list with display values(DA, NE) and return values(D, N). But I tried having it be a text field and it didnt help.
I want to be able to select multiple columns and change the data in those entries.
If possible I would also like to be able to change data in such a way in a hidden column. Or if I could get all the ROWIDs for selected records and execute a PLSQL block with them.
Ended up with noone responding so I spent a lot of time and finally came up with a solution.
var g = apex.region('myIG').widget().interactiveGrid('getViews','grid');
var r = g.getSelectedRecords();
for(i = 0; i < r.length; i++) {
g.model.setValue(r[i], 'myColumn', 'Value');
}
For some reason none of the solutions I found had worked. But I learned from those solutions and made this simple piece of code that does what I need.
Also, I was wanting to set up so I could do this set value on a hidden column, I achieved this by just having the column visible and editable, but then when running the page I clicked on the column and hid it, and set the current view as the default report.
If anyone stumbles upon this question, I hope it helps.
I'm new to Google script and hoping someone here could answer this.
I have 7 columns and each one has a drop down box so we can select a status "Ready", "Approved", "Waiting" etc.
There will soon be over 500 rows of statuses so ideally I would like to have a function on each column to automatically set the status of the column after it.
Example Cells:
Ready|Waiting|Waiting|Waiting|Waiting|Waiting|Waiting
When the first task is Approved, the cells should look like this:
Approved|Ready|Waiting|Waiting|Waiting|Waiting|Waiting
In the above example, the first cell should be clicked "Approved" by the user from the drop down list. Then the script should read the cell edit, and switch the next cell from "Waiting" to "Ready"
I am looking at the script route as I need to have the drop down cells clickable. If I put a function onto the cell itself, I lose the drop down options.
Any help with this would be really awesome!
Thanks in advance!
You may want to check this YouTube video and this transcribed code can be tweaked to suit your needs:
function setDataValid_(range, sourceRange) {
var rule = SpreadsheetApp.newDataValidation().requireValueInRange(sourceRange, true).build();
range.setDataValidation(rule);
}
function onEdit() {
var aSheet = SpreadsheetApp.getActiveSheet();
var aCell = aSheet.getActiveCell();
var aColumn = aCell.getColumn();
if (aColumn == 1 && aSheet.getName() == 'Worksheet') {
var range = aSheet.getRange(aCell.getRow(), aColumn + 1);
var sourceRange = SpreadsheetApp.getActiveSpreadsheet().getRangeByName(aCell.getValue());
setDataValid_(range, sourceRange)
}
}
And for additional insights, you may want to also see this thread.
For eg: There is a list of flights displayed on a webpage. How to get the total count of "Select" buttons displayed on that webpage
When using the Java client bindings for example you can do something like that:
int count = driver.findElements(By.xpath("//a[.='Select']")).size();
snapshot of the problem would be really helpful. Yet trying to solve assuming you have list have fights displayed and trying to find count of select button. Probably 10 flights and 10 buttons
You can use Select class in selenium.
Select oSelect = new Select(driver.findElement(By.name("Select")));
List<WebElement> elem = oSelect.getOptions();
int iSize = elem.size();
System.out.println("Count of select button " +iSize);
Assume we have a XamDataGrid with 10 columns.
Column 1 is a XamComboEditor bound to a collection in the model
This can't be changed, the data is coming from a server and the combo's collection is based on different selections within the model so it's very dynamic.
Columns 2 - 10 are just normal alpha numeric fields
The problem:
When you enter a alpha numeric and start typing the model is initialized and everything is fine. However, if you go to the very last row, the non-initialized empty one, and click on the combo editor before entering any data into any of the other fields, the combo editor is empty.
Now I am well aware of why this is happening, it's clear that this is due to the model not being initialized yet. I'm just not sure the best method to fix this.
I would hope there is a property on the XamDataGrid that adjusts when the record is initialized but I've searched the Infragistics documentation and examples and I can't find anything.
There are events for:
EditModeStarting
EditModeStarted
EditModeEnding
EditModeEnded
private void OnCellEditModeStarting(object sender, EditModeStartingEventArgs args)
{
if (args.Cell.Field.Name == "TotalQuantity")
{
DataRecord record = args.Cell.Record;
if (record == null)
return;
MyGridEntry item = record.DataItem as MyGridEntry;
// Do a thing
}
}
You can also respond to the InitializeRecord event. It can fire for multiple reasons, such as cell editing, so check the state of your row model when responding to it. All these events are on the parent grid, not any FieldLayouts or Fields.
<i:XamDataGrid x:Name="myGrid"
InitializeRecord ="OnInitializeRecord"
EditModeStarting ="OnEditModeStarting">
I have overlay in which I am having one list component.
I am selecting multiple list items from that.
I am pressing OK button and my overlay is getting disappeared.
Now What I want is :
When I open that overlay again , I want those previously selected items highlighted.
I want to do this in sencha touch.
When you open your overlay again, previously selected items should be shown or highlighted.
As per my understanding, When you click on Ok button, You would be passing selected values as extra parameter in store to load it again.
so, when you open that overlay again, you would have those extraparams in the store...so, you can do below things. I am sure, It will work.
var store = Ext.getStore('storeId'),
selectedItems[],
selectedRec,
selectedRecs = [],
extraparameter = store.getProxy().extraParameters;
You can get selected transaction types like this.
selectedItems = extraparameter.selectedItems
Ext.Array.each(selectedItems , function(selectedItem) {
selectedRec = multiSelect.getStore().findRecord('transaction_type', transactiontype);
selectedRecs.push(selectedRec);
});`
Thanks !