PHP Wrappers: Mapping of XML-attributes to a model

3 posts, 0 answers
  1. Florian
    Florian avatar
    2 posts
    Member since:
    Mar 2013

    Posted 18 Mar 2013 Link to this post

    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. Vladimir Iliev
    Admin
    Vladimir Iliev avatar
    2172 posts

    Posted 20 Mar 2013 Link to this post

    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!
  3. UI for ASP.NET AJAX banner
  4. Florian
    Florian avatar
    2 posts
    Member since:
    Mar 2013

    Posted 03 Apr 2013 Link to this post

    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
Back to Top