This is a migrated thread and some comments may be shown as answers.

PHP Wrappers: Mapping of XML-attributes to a model

2 Answers 94 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Florian
Top achievements
Rank 1
Florian asked on 18 Mar 2013, 03:40 PM
Hello

How can I map an attribute of an XML data source to a Kendo UI model?

I explained my problem here:
http://stackoverflow.com/questions/15273312/mapping-grid-column-fields-to-xml-attributes-via-php-wrapper

But got now answer.

Thanks and best regards.
Florian

2 Answers, 1 is accepted

Sort by
0
Vladimir Iliev
Telerik team
answered on 20 Mar 2013, 08:57 AM
Hi,

This happens because your PHP code is not equivalent to the JS one - the JavaScript code has "@" in front of the field names whereas PHP doesn't. Try adding @:

$codeField = new \Kendo\Data\DataSourceSchemaModelField('@code'); 
$codeField->type('string');

Kind Regards,
Vladimir Iliev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Florian
Top achievements
Rank 1
answered on 03 Apr 2013, 10:15 AM
Dear Vladimir

I did that. But the resulting JavaScript code looks different. This is what the PHP wrapper generates:

"model":
   {"fields":
      [
         {"field":"@code"},
         {"field":"@description"}
       ]
    }
}

And this is plain JavaScript which works as expected:

model: {
fields: {
description: "@description",
pharmacode: "@code"
}
}

Regards
Florian
Tags
Grid
Asked by
Florian
Top achievements
Rank 1
Answers by
Vladimir Iliev
Telerik team
Florian
Top achievements
Rank 1
Share this question
or