Is there a way that would allow me to create tables within a view controller and then position them? I have an array "items" that would output the total amount of TableViews -1. So for instance if the array "items" contained 15 items, 14 TableViews would be created.
Can you add n tableViews to a single view controller? Yes, but it's not practical or reasonable to write the amount of code you'd need to manage a varying number of layouts and delegates.
A tableView is designed to scroll (sections or) rows of cells, not to show a single item on screen. If you are determined to layout each item, you would be better off using a (much lighter) custom view instead of a tableView.
However, a single UICollectionView can do what you want to do. Yes, you'd have to write some code to manage the flow layout, depending on the number of brackets it had to display, but you could easily manage a grid-based approach with each column (round) showing teams and score.
This would certainly be more intuitive and practical to have a single scrollable region, where each bracket is able be selected and interacted with, instead of trying to add multiple tableViews to a view (controller).
Related
I am using the MVVM pattern and I would like to sort the elements on a datagrid. In my view model I have an ObservableCollection with the element for the datagrid.
In the datagrid I can sort element cliking in the column name, so that is nice, and for multiple columns. I like this feature.
However, I would like to do some more specific ordering, for example show first the element which the ColumnB has "valueC" and later the rest of the elements, and when I sort for a column name, order for that column but show first the elements with "valueC" and later the rest of the elements sorted by the column that I clicked.
To do that, I can sort the elements in the ObservableCollection of the view model, but I think that this functionality is more something that it would be done in view, plus because I would like to sort by columns, so I would have to say to the view the column that is clicked.
However, I don't know if it is posible to do this kind of complex sorts in the view, perhaps with some converter or with any way.
Thank so much.
Every logic has to be done in the ViewModel. View must not know anything about the logic behind displayed datas.
In a simple case you could order your items in a view but in a realistic case, ordering will not affect only visible items but it affects also items not shown because of the paging.
Is it possible in ExtJS to display different records from a store in different grids? I have a Store containing contact information (name, department, phone number) used to populate the contacts tab of my application. My goal is to be able to add grids elsewhere in the application that display contacts from specific departments (eg a grid for everyone in the tech department, another for everyone in the sales department). However, when I attach a filter, the filter seems to apply to the store itself, changing the display of all of the grids to the last version I try to load.
Do I need to create child grids and sync them to make this work?
No, it is not possible. The store gets filtered, not the grid itself. You do have to create multiple stores and assign a different one to every grid.
Another way to say it is that store (when used with a grid) is a ViewModel, that is, a model that is kept in sync with the view. Therefore, the same store can't be used for multiple views as you would expect.
No, but if you need a work-around, use same store for all the grids and filter store on grid's aftererender listener. But if you use these grids on tab then you need to do it on viewready event. Anyway, using same store for multiple grids will not be a good idea. Think twice before use.
I'm writing an app where i want to compare the data from two different data sources to see if there are any differences. All examples i have seen of similar functionality always place two datagrids next to each other so that you can see each row side by side.
This makes it very hard to spot differences. What i would like to do is to show the rows one above the other in agridview. That is, alternate the rows in the datagrid to be bound to one then the other datasource as a matched pair. Actually i would also like to add a check box to one row so that the pair can be selected for futher processing.
I know that the controls are very customisable but is something like this possible ? Or would i need to combine the two data sources into a single one and then bind it ?
What you're looking for is MultiBinding
This will enable you to bind multiple items and by using a converter to return a new single item. So essentially, yes, you will combine the two data sources into one inside the converter.
Right now I use 2 arrays one of TImage the other of TMemo to draw an image next to text data row after row inside a scroll box.
I am looking to replace the TMemo with several components on a Panel. So probably some static text a button and some labels. But the way I'm doing it now it seems as if this will become messy.
Is there a better way of going about this without writing a component or class. Should I be using some sort of multi dimensional array or can I use a record structure to declare the components and have an array of that?
A record would at least relieve you of the burden of managing lots of parallel arrays, but you can do better than a record, and better than an array.
First, you can design a frame to represent one "row" of your form. Give it an image, button, label, and whatever else you need. Then create an instance of that frame class each time you need one. It will create the components for you automatically. You said you didn't want a custom component, and that's essentially what a frame is, but by getting to design it visually like you would a form, much of the burden of creating a composite control is lifted, so you just get the benefit of a group of related controls that can interact with each other as a unit.
Instead of an array, you might find better success with a different collection object, especially TComponentList which can grow and shrink more easily than an array, and also helps manage ownership of its contents.
Can a DataGrid dynamically mask the columns to be displayed?
Current Setup
DataGrid <--Binding--> Collection<Customer>
The type Customer has about 100 different fields defined.
Different views need to display different sets of columns (about 20 out of 100), chosen somehow dynamically, of the same Collection<Customer>.
Is there an option to dynamically mask the fields that will be displayed as columns in the DataGrid? Ideally, I want to use Infragistics' xamDataGrid, but any solution for a DataGrid will be a good starting point.
There are other similar questions out there, but they deal with either column filtering or variable number of rows.
If you are defining different views in code you could create different FieldLayouts and use the FieldLayout for the view that is needed. This would require setting the FieldLayout to be used in code by adding the layout to be used to the FieldLayouts collection.
If you are allowing the end user to define what is in the view, then you will likely want to define all possible fields and then allow the fields to be hidden or shown with the Field Chooser.
There are methods for saving and loading customizations to the fields that you can use to persist the layouts.