'pdfjs' => [
'class' => '\yii2assets\pdfjs\Module',
],
<?= \yii2assets\pdfjs\PdfJs::widget([
'url'=> Url::base().'/automir.pdf'
]); ?>
frontend/web/
echo ListView::widget([
'dataProvider' => $listDataProvider,
'itemView' => '_list',
'layout' => "{pager}\n{summary}\n{items}\n{pager}",
]);
'layout' => "{items}",
class News < ActiveRecord::Base
belongs_to :user, foreign_key: :login, primary_key: :login
end
class User < ActiveRecord::Base
has_many :news, foreign_key: :login, primary_key: :login
end
class CreateNews < ActiveRecord::Migration
def up
create_table :news do |t|
t.string :login, limit: 50
t.timestamps null: false
end
add_foreign_key :news, :users, column: :login
end
def down
remove_foreign_key :news, name: :login
drop_table :news
end
end
class CreateUsers < ActiveRecord::Migration
def change
create_table :users, id: false, primary_key: :login do |t|
t.string :login, limit: 50, null: false
t.timestamps null: false
end
end
end
class CreateProduct < ActiveRecord::Migration[5.0]
def change
create_table :products do |t|
t.belongs_to :user, foreign_key: true
# ... остальные поля
t.timestamps
end
end
end
<DataGrid x:Name="dataGrid" MouseDown="dataGrid_MouseDown"/>
private void dataGrid_MouseDown(object sender, MouseButtonEventArgs e)
{
if (e.RightButton == MouseButtonState.Pressed)
{
var row = DataGridRow.GetRowContainingElement(e.OriginalSource as FrameworkElement);
if (row != null)
{
// dataGrid.SelectedIndex = row.GetIndex();
dataGrid.SelectedItem = row;
}
}
}