soopers Posted September 4, 2014 Share Posted September 4, 2014 Hello guys, how are you ?I have three tables "A", "B" and "C", all the tables have 'name' fields, now I am saving the "B" and "C"'s table data in table "A" such that I am changing the field display property using javascript and can save both the tables i.e. "B" and "C" data in either field. Now In "A"'s admin gridview I want to display both fields data that I have stored in "A" table and it displays the ids of all those records. Now I want to display the 'name' of the records of "B" and "C"'s tables instead of their ids. So how can I do this ?One option is to use Joins and Unions. But I don't have that concept.Please anyone who knows the solution help me ?Thanks in advance. Link to comment Share on other sites More sharing options...
Larry Posted September 5, 2014 Share Posted September 5, 2014 I don't recall the exact syntax offhand, but you can use the defined relation to have Yii load this for you. Basically, instead of specifying that you want property `something` from table A (i.e., the current model), you'd request `relationName.otherTableColumn`. Link to comment Share on other sites More sharing options...
soopers Posted September 12, 2014 Author Share Posted September 12, 2014 Thanks Larry for your reply. Actually I have to fields and two models data, and I am switching the fields and in both the fields both models data can be saved. So when in cgridview, I want to display that two fields data, then I want to display the name fields data instead of id. Now in both of fields, both models data is saved, so how can I classify that data regarding to their model ? Link to comment Share on other sites More sharing options...
Recommended Posts