Checkboxes and View Based Table View - nstableview

I am having some difficulty trying to use checkboxes as the selectedIndex in a view based table.
There is good documentation on view based table here:
[View Based Tables ]
However, I after searching and looking on Stackoverflow I can't seem to get my implementation for doing the following.
My view is a table that makes a callout to Yahoo Finance. The table is view based constructed with bindings.
When the table is populated I want to have a check box against each row so that when the user clicks the check box, that row will be updated from Yahoo. Currently this works using multi or single selection using the table view and an observer.. I want to do this with the checkboxes and a button that gets all the checked rows.
The IB setup is as follows:
What is the best way to get the rows where the checkbox is selected? Should I use the array controller or do I need to do something with the table?

Assuming that you use a NSArray of NSDictionaries as your data model, why not add a key/value pair to each "stock" dictionary as a flag? Then in your button action method, just iterate through the data model and trigger an update when the flag is set. Bindings do the rest!

Related

In App Maker, can you fake valueIsRecord with a dropdown field?

In App Maker, what is the simplest way to achieve the same result with a dropdown box that you can with a suggest box, which can return the whole record when you make a selection giving you the ability to assign associated record values to other fields on the page?
Consider a data model with three fields, (Code, Description, and Severity). Add a dropdown box to select the Code. Have the selection, (probably using onValueChange or onValueEdit), write the selected Code's Description to a label field beside the dropdown box. The Code's Severity will also be used to affect the style in some way like background color or something, but for this answer, merely assigning the value to a scripting variable will be good enough. It's the record value access and assignment mechanism I am after.
Clarification: This data model will not be the page's datasource. It is a secondary reference table used for assigning a code to a ticket. You can also assume that a record value will be written to a field in the page's datasource as well.
I would appreciate the simplest low code solution as we will have non-programmers attempting this. Thanks.
As long as you leave your value binding on the dropdown blank the following should work:
Set the options binding to:
#datasources.YourDatasource.items
You may want to consider changing the 'Names' binding to be the projection of a particular field in this datasource otherwise the values showing in your dropdown will only be the 'keys' from this datasource.
Then in your onValueEdit event you will gain access to individual fields like this:
var item = widget.datasource.item;
item.YourFieldToEdit1 = newValue.YourOtherDatasourceField1;
item.YourFieldToEdit2 = newValue.YourOtherDatasourceField2;
That would probably be the simplest way.

Filter and Bind a Multiselect

I am trying to implement a Many-to-Many relation between a class and its students in a form.
The form can be used to create or edit a class. Also students can be added to that class. To reduce the effort needed to enter students, I would like to add a multi-select that shows the entries from the students-table. But since the number of students is expected to be large, I would like to filter this multi-select.
I checked this question on filtering lists and the sample app "Project List. I understand that the standard workflow with a table would be to bind the value of a search box to the #datasources.STUDENTS.query.filters.email._contains and set the tables datasource property to STUDENTS
But, as I understand it, a multi-select element's value property must be bound to #datasource.item.students and its datasource property must be CLASS in order for the auto-saving to work.
Hence I wonder whether it is possible to filter a multi-select element.
I don't see the problem, but I think I see a misunderstanding.
You said: "I understand that the standard workflow with a table would be to bind the value of a search box to the #datasources.STUDENTS.query.filters.email._contains"
You need to bind the OPTIONS (not value) to the datasource query, as it is the options that will draw its records from the #datasources.Students.query datasource.
You can then set the VALUE of the multi-select widget to #datasource.item.students (where you want selected values from the student query options to be saved).
You will also need to set the NAMES property (since the options are likely student records). Names will be the Student datasource projection of whatever string field you want to appear in the options list.

Creating an expandable grid in MVC3 - data modelling

I am trying to create an expandable grid in MVC3. This is a follow up question to this .
Basically I have a complicated sql query that I need to use to populate a set of fields in a grid in MVC3. Also the grid elements must be expandable and on expansion should show additional data.
For example
I have two sql queries
Query A
select * from large tables joined
Query B
select data from selected row in query A
Query A represents my first query which I should use to populate the grid. On expansion of the grid I have to show the additional data by expanding the row from A with the query B.
I am creating a view model with all the fields I need in the first row of the grid that I can pass to the view.
Questions:
1.) How do I directly use sql to pass the data into the views instead of joining the models
2.) How do I make the grid expandable to show additional data?
3.) How do I model my sql, do I create one query for both and then selectively show data?
Caveat: MVC3 noob
Answers inline
Questions:
1.) How do I directly use sql to pass the data into the views instead of joining the models
This depends, either you pass in everything up front and write out hidden fields, or a hidden JSON object containing all the data and when the field is expanded, show it. so that is: Render all the data in your grid and hide each item until you need it, or dynamically load it from an array and show it when the user expands. You could also dynamically grab the required data when a user clicks on a row, but then you'd need to show a wait image while you grab the data by ajax (which would be fairly easy with mvc)
2.) How do I make the grid expandable to show additional data?
Plenty of expandable html grid results on the net :) Depend show you want to hide/show it.
3.) How do I model my sql, do I create one query for both and then selectively
This depends on the approach in 1 above. If you use ajax, you'd be returning one row at a time. In the other scenario you can have two queries you then merge into two view models or you join query A results with query b if theres a 1-1 mapping, assuming there isn't though so make two calls. Again, this is up to you. Do you want to pass all that data up front if the user will only expand two rows? not likely, in that case I like the ajax approach.

Populate a value in combobox dynamicly

I have a form where user picks a Item# and gets info for the selected Item. This form got enhanced by adding another filter, using a combobox control, to select a 'warehouse'.
I could use a lookup for the warehouse(the list is huge) to chosse a 'warehouse' but what am trying to do to query warehouse on Item# value and populate into combobox.
Tried to attached a screen shot, unfotunately, the system doesn't let me do it. If I need to put more details, please let me know.
Is it doable?
I would suggest you to do this with a temporary table. Create one in AOT, and declare it as global variable in your form.
When Item (datasource field or design control, choose what's more accurate for you) is modified, just delete table content, and fill it at your needs.
In the control lookup method, call temporary table lookup method, i.e. "static void lookup(TMPTable _tmpTable)". Do a SysTableLookup, with a standard query over TMPtable, but it's important to use QueryBuildDataSource.setCursor(_tmpTable) (I don't remember now where was method setCursor() in Query or QueryRun, search for it a bit).

Grid form layout using jsf (Jdeveloper & ADF)

I am trying to build a 6x6 grid layout. In each cell, there will be an input check box. I want to bind the checkboxes to my backing bean in a "consecutive fashion"...meaning, I would like to be able to iterate over the checkboxes to see whether they are checked or not. Basically, there must be an underlying data model. For example, you can drag over and drop off as a table, any item in the data control palette. Then in my application module, I can modify the view object as I wish before I save to the database. Now if I have a table with 36 rows and two columns (one is Id, one is Numeric (1 or 0)). I would like to drag over that table and drop off as a Grid that will enable a user to update each of the rows by selecting or 'un-selecting' a checkbox.
Try to use for each or Iterator component. They iterate over some array/collection and repeat elements enclosed within those components. You can check how Oracle does Dynamic Table (when you drag view object instance from application module to a page, choose dynamic table option) to get and idea.
try :
http://jobinesh.blogspot.com/2010/06/model-driven-approach-for-building.html
http://blogs.oracle.com/shay/2010/10/adf_faces_dynamic_tags_-_for_a.html
also try google with "dynamic form adf"

Resources