Answer the question
In order to leave comments, you need to log in
How to display in Ext.grid.Panel the value of a field of a related table?
Hello! Started learning extJS and got stuck.
There are two tables:
Таблица users: с полями [
id int,
login string,
id_status int (ссылается на поле id таблицы get_status)
Таблица get_status: с полями [
id int,
status_name string
Ext.define('User', {
extend: 'Ext.data.Model',
idProperty: 'id',
fields: [
{
name: 'id',
type: 'int'
},
{
name: 'login',
type: 'string'
}
{
name: 'id_status',
type: 'string'
}
]
});
var users = Ext.create('Ext.data.Store', {
model: 'User',
autoLoad: true,
proxy: {
type: 'ajax',
url: 'users.php',
reader: {
type: 'json',
root: 'users'
}
}
});
Ext.create('Ext.grid.Panel', {
title: 'Пользователи',
height: 200,
width: 600,
store: users,
columns: [
{
header: 'ИД',
dataIndex: 'id'
},
{
header: 'Логин',
dataIndex: 'login'
},
{
header: 'Статус',
dataIndex: 'id_status'
}
],
renderTo: Ext.getBody()
});
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question