In flutter I'm trying to have one of the columns of a DataTable be a DropdownButton. I would like the DataTable rows to populate from getUsers initially, then be able to edit the cell cell with a the DropdownButton based on the ratingList.
So I would like to be able to change the value of the DropdownButton cell to any of the values in the ratingList: ['Ok', 'Good', 'Great', 'Amazing']; Note I want to be able to select 'Great' or 'Amazing', these aren't one of the initial populated values.
It is essential for the data to be loaded from getUsers, as this will be grabbed from Firestore eventually. Then have the ability to change a DropdownButton cell after the data is loaded, based on the ratingList of values, which is a complete list of the ratings.
See below for example code (DropdownButton doesn't change cell value), also in DartPad.
Thanks in advance!
Just put user.rating = newValue into setState block.
Like this.
onChanged: (String newValue) {
setState(() {
//help!
user.rating = newValue;
});
},
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.
I'm newbie in Ember.js framework, and I have a problem, I need a multiple selection of rows in a table. I'm using jQuery Datatables, with Ember-Data, and I need to have an ID of the selected rows, something like push to the array and I have no clue how to do this.
For multiple selection, make sure you initialize the table with the select option set to "multi":
this.$("#myDT").DataTable({
select: "multi"
});
When you want to get the list of all the rows selected, use a jQuery selector to get all the rows that have the selected class and get their data. In this example, the ID is the first column in the data, hence the [0]
var selectedRows = Ember.$('#myDT tbody tr.selected');
var selectedIDs = [];
Ember.$.each(selectedRows, function (i, element) {
selectedIDs.push(table.row(element).data()[0]);
});
You can read more about DataTables API (for things like getting row data using the row.data() method here: https://datatables.net/reference/api/
I have created a filter that contains unik values of column:
{
header : 'Вопрос А',
dataIndex: 'answerA',
itemId: 'answerA',
width : 100,
filter: {
type: 'list',
options: this.getStore().collect('answerA'),
},
editor: 'textfield'
}
When the user inputs new value in the cell of the column this value must appear in the filter. How can I do this?
I have looked at Extjs Grid Filter - Dynamic ListFilter but it doesn't help me much.
You should carefully look at StringFilter.js file which is at ux/grid/filter. I did this myself by adding a combobox to each filter. On combo expand I update its store by parsing the corresponding column data. Besides I advise you to collect unique values, for this task use Ext.Array.unique function. Otherwise, if two cells contain the same data both values will go to the store, which is not good, because any of them will produce the same filtration. I do not attach my code, because it is heavily dependent on my custom data types, but the idea is quite easy, I think.
I have an Infragistics UltraWebGrid bound to a datasource; I am trying to allow the user to change the value of a few cells in the row, so I am trapping the CellClick event in code behind. While the event's argument gives me the cell key (which is the column name), I still need to have the selected row DataKey so as to make the change in the database. Anyone knows how to get that?
Thanks
Chris
You can use the igtbl_getCellById utility function to get the cell. Once you have the cell, you can get it's row and then it's key:
var cell = igtbl_getCellById(cellId);
var row = cell.getRow();
var key = row.DataKey
The following references may be helpful:
WebGrid utility functions
API documentation for the Cell object
API documentation for the Row object
Alan