Infragistics UltraGrid with Expandable Rows - windows

I'm showing to my users, a list of items within a UltraGrid, that come from database.
Now, i'm with one need and I don't find anything useful or any documentation that is clear nor none tutorial is available where I can learn.
I need extend the functionality of this grid, to, set a (+) Expand function, that, when the user press that button (+), the row expands and shows the items that are in the History.
It is anyone in the world that can help me to solve this issue or indicate appropriate docs where I can Learn?
Very thanks.

The trick is simple. You just need to bind the grid to a DataSet that contains two (or more) tables and the correct DataRelation object that glues together the tables.
You need also to be sure that the property grid.DisplayLayout.ViewStyle is set to MultiBand (it is the default so it should be already set).
So, for example, in this pseudocode I load two tables and add them to a dataset, then I define a supposed relation between the columns involved and at last I bind the dataset to the grid.
DataSet ds = new DataSet();
DataTable dtItems = YourLoadDataTableMethodHere("Items");
ds.Tables.Add(dtItems);
DataTable dtHistory = YourLoadDataTableMethodHere("History");
ds.Tables.Add(dtHistory);
DataRelation rel = new DataRelation("Items_History_Relation",
dtItems.Columns["IDItem"],
dtHistory.Columns["IDItem"]);
ds.Relations.Add(rel);
grid.DataSource = ds;
This will automatically force the UltraGrid to create two Bands (grid.DisplayLayout.Bands[]), in the first Band (Band[0]) you will find the rows of the Items datatable, each row has its [+] button to click and expand the second Band (Band[1]) where you will see the History rows related to the row in the first Band

Related

Adding a drop-down menu (data validation) after each row of a query result in Google Sheet

First, here is the link to my sheet:
https://docs.google.com/spreadsheets/d/1067N1SAIwpGkMRBZiUv4JW8yDNkozuGt7Fwh6GW-qvE/edit#gid=1742559851
If you look at the tab called "Selection", I have two columns called "Select". All the data in these tables is collected by a query function, except column "Select". In that column, I need to add Data Validation (a simple Yes or No). I want the Data Validation to be automatically added when a new row is created but the query function instead of having to add or remove it manually every time I make some changed. Data collected by the query function is using the two variables on top of the sheet (minimum rating and global buff).
Just to show the step to apply data validation to your whole column, see the following image. Under Cell Range, the image shows Selection!D5:D99, but this is actually set to Selection!D5:D999, it just is truncated due to the size of the text box.
Let us know if this is what you were looking for, or if I've misunderstood your issue.

How to update a Google Forms dropdown list based off an existing spreadsheet?

So I've been looking for a way to do this and found many interesting answers about Google App Scripts, but none seem to get at what I am trying to do. I am looking to have a Google Sheet (Spreadsheet) with a column of choices. Then I have multiple forms which has a question that uses a drop down menu of those same choices. However, this list of choices gets updated semi often, so we currently find ourselves manually updating 6+ forms with the new information based off of the sheet. I'd like to know if there is a way to take the information from a spreadsheet and have it automatically update the drop down list.
I haven't really done any Google Script stuff, but I can hold my own in scripting generally. I just need help finding the right direction.
You can try getting a range of values from the sheet and loop through a column until last row as below code.
var values = SpreadsheetApp.getActiveSheet().getDataRange().getValues()
for(n=0;n<values.length;++n){
var cell = values[n][x] ; // x is the index of the column starting from 0, replace x with some value
}
Once you get the values into cell variable, you can simple add them to the form drop down list.
// Open a form by ID and add a new list item.
var form = FormApp.openById('1234567890abcdefghijklmnopqrstuvwxyz');
var item = form.addListItem();
item.setTitle('Do you prefer cats or dogs?')
.setChoices([
item.createChoice('Cats'),
item.createChoice('Dogs')
]);
You can refer to this documentation.
Hope that helps!
You should be able to use a formRanger AddOn which would allow you to update a spreadsheet.
This would then automatically update all the drop down dependent on the data you have added to the spreadsheet.

Google Spreadsheets: Working with data inserted from forms across tabs

I'm in great need of help. I've a form which asks basic questions and puts the results into rows of an existing spreadsheet.
Specific data from those responses are "promoted" to 2nd, 3rd and 4th tabs based on IF formulas on tabs 2+ checking the value of a pull down selection on in the corresponding row on each previous tab. (Waterfall)
My challenge is - forms data is inserted into a new row (Does not use existing) and if I set the pulldown value to "Approved" on the first tab, the formulas on the second tab which were contiguous now skip the row where the form data was automatically entered.
I suspect I need to learn how to properly use ArrayFormula, etc, but have not managed to fix this looking at existing examples combined with my IF statements.
Help is appreciated. Sample is here. Safe to ignore the first and last tabs.
Thank you.
You can try using an open-ended range with ArrayFormula. For example, the formula on "2-Pipeline" in cell D3 could be:
=arrayformula(IF('1-IdeasReceived'!U2:U="Approved",'1-IdeasReceived'!L2:L, ))
The ranges U2:U and L2:L should pick up all rows in those columns, even after you've had forms submitted.
Since this is an ArrayFormula over column ranges, you only need it in cell D3; it will inject CONTINUE formulas down the rest of the column.
Warning: Your spreadsheet is combining dynamic row content (e.g. pulled from another sheet) with static content (e.g. "Environment, Health & Safety" column on "2-Pipeline" sheet). This is bound to result in misalignment if rows are added or deleted in the middle of the source data.

Set data validation for column including new rows

I have a column in a Google spreadsheet with data validation, that makes a drop down menu available when editing existing rows. Occasionally though contributors create new rows at the bottom of the doc and this validation is lost.
I would like to keep this validatation in the column even in newly created rows (excluding the header row).
I have seen much of this discussion throughout stackoverflow and google help forums, but still cannot find a clear answer.
My hunch is that this would involve Google Apps Acript using an onEdit trigger and then either paint formatting or a combination of the confusing class DataValidationBuilder. (https://developers.google.com/apps-script/reference/spreadsheet/data-validation-builder) but I'm not sure beyond that.
While not necessarily elegant I found the following to work:
create your validation on the entire column
once that's done click the cell(s) that represent the heading, select data / validation, and then click on 'remove validation' on that single cell.
This way any newly inserted rows will inherit the validation set up on the entire column and you don't have to always be reminded that your heading isn't a valid value.
onEdit trigger which uses Range.getDataValidation() and Range.setDataValidation() to copy the rule from an existing row to the new row
While in the data validation dialog screen you can manually enter the range as "Sheet1!A:A" to apply the formula to all of column A.
This also includes new rows added afterwards
I'm not sure if this is a new feature but this worked. Set the validation as list from interval and interval as:
'sheet'!C2:C
This includes all new rows excluding title(first row)

Adding new row in correct position to a user sorted wingrid with bindingsource

I have a Infragistics UltraGrid using a bindingSource.
If I add a new object to my binding list, it adds a row to the bottom of the grid which is fine if there's no user defined sort.
Question is if the user clicks on a column header to sort the grid, is there a way for new rows to appear in the proper sorted order instead of always on the bottom?
Re-sorting all rows on every insert is too expensive.
Seems kind of ghetto. Infragistics support also indicated that the RefreshSortPosition() method is the only choice.
// Add to binding list which will trigger a row to be added to the bound ultragrid.
this.bindingList.Add(new Person("Smith", "John"));
// Get length since we know this will always be added to the end
int length = this.ultraGrid.Rows.All.Length;
// Get it to sort
this.ultraGrid.Rows[length - 1].RefreshSortPosition();
To be a bit more efficient, you can always be clever by disable redrawing, etc and then call refresh on a bunch of rows after a batch of orders, etc...
Hope that helps. I had very little luck Googling this problem.

Resources