Вопрос

I am curios about the implementations of the idProperty one in the model and one in the reader and then a idParam for the proxy and a clientIdProperty on the model

How do we I use them in a right way?

Это было полезно?

Решение

if you get this as a response from the server:

{data: [{userid: 1234, username: "foo"}, {userid: 1235, username: "bar"}]}

so in your UserModel you will have idProperty: "userid" this will tell ExtJS which field to use for functions like getId(), getById(). You could also define this in the reader to share between some models, but usually you should define the idProperty in the model.

idParam seems very unclear to me, it is used only 2 time in the whole framework. is only used to modify the request id parameter send to the server. I don't think this is a parameter you will ever need to change.

clientIdProperty is needed for create operations if proxy.batchActions == true. For example: model.clientIdProperty = "extid" this will send to the server if we create 2 users:

{data: [
    {extid: "ext-user-1", username: "foo"},
    {extid: "ext-user-2", username: "bar"}
]}

server response:

{data: [
    {extid: "ext-user-1", userid: 1234, username: "foo"},
    {extid: "ext-user-2", userid: 1235, username: "bar"}
]}

this will tell ExtJS how to map the server ids to the pre-generated ext ids.
(if clientIdProperty is null, ExtJS assumes the same order of request and response for the mapping)

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top