人人人妻人人人妻人人人,99精品国产综合久久久久五月天 ,欧美白人最猛性XXXXX,日韩AV无码免费播放

News新聞

業(yè)界新聞動態(tài)、技術前沿
Who are we?

您的位置:首頁      樂道系統(tǒng)FAQ      Yii2-GridView 中讓關聯(lián)字段帶搜索和排序功能示例

Yii2-GridView 中讓關聯(lián)字段帶搜索和排序功能示例

標簽: 發(fā)布日期:2017-01-21 00:00:00 247

情境要求:

要在訂單(Order)視圖的gridview中顯示出客戶(Customer)姓名,并使其具有與其它字段相同的排序和搜索功能。

數(shù)據(jù)庫結構

訂單表order含有字段customer_id 與 客戶表customer的id字段關聯(lián)

首先確保在Order Model中包含以下代碼:

public function getCustomer()
{
  return $this->hasOne(Customer::className(), ['id' => 'customer_id']);
}