Master Detail view with yii framework - yii

I have been looking all over for an example of creating a master-detail view using yii - possibly using a dropdown list and a gridview.
I have two tables Objectives and Outputs where a given Objective can have one or more Outputs. I would like to populate the dropdown with the Objectives and display details of the Outputs (of selected Objective) in the gridview. Will be grateful for some help.

Here is a recent wiki that gives a solution using CGridViews for two tables having a MANY-MANY relationship with a third junction table specifying the relations. I think it could be adapted easily to your situation.

Related

How to store a List or Collection in a dataset table/column? (VB.NET)

I have a dataset table with various columns that are created during form load.
These columns are currently either system.double or system.string types.
And it is displayed in a datagridview.
This works fine.
But I need another column that can store a "list" or some collection in the data table.
A list of strings would do but a custom class would be better.
How is this usually done?
I have spent literally weeks googling this and I dont know where to start. The more I have looked the more confused I have ended up. I end up with more questions than answers, like how is it displayed in the datagridview? I read about a combo box?
I hope someone can give me some pointers in how to get this achieved. I've not posted any code as I think its more the theory of this I need help with.
What you are asking for has does have multiple concerns for most programmers. The storage of data (#1) and the displaying of said data to the user (#2)
For #1 I recommend the .net entity framework. It gives support for storing, querying and updating classes for use in the database. Through most tutorials that I have found it is possible to model the structure of the database tables and their relations and then build a database around that model OR to use an existing database and create entities (entity framework's class objects) around the existing structures and relationships.
Here is a link to a very good beginner tutorial that I have used before: CodeProject Entity Framework Tutorial for Absolute Beginners
For #2 I can recommend the Windows Presentation Foundation. It has lots of bells and whistles to make using a data source and displaying the relevant dependent data very easily through its unique method of data binding. From the tutorials I have used on PluralSight it can be as easy as dragging and dropping from an imported data source like the entity framework database. Alternatively, one can just handle selected row changes for one data grid and then show the dependent data in another data grid.

How should I model a database with Entity Framework?

I'm just starting to use Entity Framework Designer. I would like to ask how should I create my Entity files. I would like to have like 10 tables and all of them will be linked to at least one other table by some row. Should I create just one file and put all my models there or create a separate file for each model.
I don't know if this is even a question but I could find my answer on Google. I didn't know how to define it actually... :D
So if you have any tips on how I should model my database that will be awesome. Also if you have any more information on when I should use different Entity files that will be useful too.
I have used MySQL designer in the past but in there as far as i can remember you just move the model into the designer and you can make relations. So I'm kinda keen into doing that (all models in one Entity File) but wanted to check with you first guys.
just try this plugin for VS http://visualstudiogallery.msdn.microsoft.com/72a60b14-1581-4b9b-89f2-846072eff19d to generate your classes from existing db

Core Data Relationships Binding in IB

I have a simple program that stores purchase information in a core data store. The model is similar to the following.
Entities:
Student(lastName,firstName) relationship to (BoughtPackage)
BoughtPackage relationship to (Payment) and (Package)
Payment(type,amount)
Package(name,price)
Structure looks like
I would like to first display the list of students in a table, then format the purchases made my that individual student in a details table.
So far, I have been able to create an NSArrayController to hold the data of the Student entity, but cannot figure out how to propagate the purchase detail table. How would I accomplish this using IB alone, or is it possible? If so, how would I do it programmatically?
Yes it is possible to do this mostly in IB without writing any code. But thats too broad a question for a SO answer
You really need to read
https://developer.apple.com/library/mac/#documentation/cocoa/conceptual/cocoabindings/cocoabindings.html
and theres a tutorial in the docset titled
Introduction to Developing Cocoa Applications Using Bindings: A
Tutorial
which i can't find a web link for. Just search the title.
But sort out your model too. It looks like all your relationships are one-to-one
For example. I would expect that a Student may have many BoughtPackages hence a one-to-many relationship there and the same with BoughtPackage to Payment.
Good luck

Rails Line Items Help

i'm trying to figure out the best way to do shopping cart for bicycle components. the problem that i'm encountering is that i can't just add all the components to the same model because they each have different specs (i.e. a chainring has a column for "number_of_teeth" while a fork has a column for "crown_diameter").
right now i have a table for each component but that makes it difficult to look up information for that item in that i need to have each component listed in the controller which seems redundant. am i better off just making a components model and having a "type" column then adding a "specs" column that will connect to another table, say chainring_specs, that will have all of that information?
i want to get this set up the best way possible. thank you.
Yes, in my opinion, creating a more generic components model will give your web app a lot more flexibility. I'm assuming that you'll have a database feeding this shopping cart.
Your model(s) will be shaped by the type of back-end schema that you use. A one table schema that can support all of your components will allow you to handle skus, pricing, etc. in one place. Depending on the type of complexity that you face, you might want to have the description and specs in separate tables.
Hope this helps!

How would you add a Group Feature like iChat's to your Core Data App?

I am Developing A Core Data App, and would like to add a feature like the Groups feature in iChat to my App. The Feature would be displayed in the table with normal table rows and more groups could be created. Other rows of the table could be dragged into the Group and the Group could be collapsed and opened. What code would I need to do this and Is it possible?
Check out NSOutlineView. Basically, what you're going to want is two different Core Data entities: Group and Child. Group would have a to-many relationship, children, to Child objects, and Child would have a to-one relationship, parent, to one Group entity.
That's enough to get the basic model defined. Past that, you need to break your question down more. For example, how do I implement drag & drop using Core Data? That's been answered many times. How do I mix two different entity types in a single outline view? Also answered before. Break the question down into each individual sub-task and look for an answer – I'd bet most of them of them have an answer on Stack Overflow.