Orthogonal editor php

Orthogonal editor php

belubelu Posts: 38Questions: 14Answers: 0
edited February 2019 in Free community support

Hi there,

Is there a php function in editor to provide orthogonal data?
If not, would it be possible to provide a subarray instead of the value for a field?
Providing the different data types in php would be mich easier for me, because I have already many of the needed functions... how do you handle this „problem“?

Thx!
Bernhard

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 61,716Questions: 1Answers: 10,108 Site admin

    Perhaps you could explain what you are looking to do please? The orthogonal data is handled on the client-side by a rendering function.

    Allan

  • belubelu Posts: 38Questions: 14Answers: 0
    edited February 2019

    yeah - fortunately I got that so far ;-) Sorry for being not detailed enough!
    It would be nice, if there was also the possibility to provide the orthogonal data already with the JSON string. e.g.

    data:{
    ...
        tablename:{
               columname:{
                    "_": "default_value",
                    "display": "display_value",
                    "sort": "sort_value",
                    "export": "export_value",
                    ...
    }}}
    
    client-side JS:
    ...
    data: alias.field_name,
    render:{
         _: "default",
        display: "display",
        sort: "sort",
        export: "export",
        ...
    }
    

    So I was wondering, if there was a function in the server side .php (Editor-class) to
    provide this data structure. So all the data manipulations would be made in php instead of JS. In this case JS render would be only used to assign the right fields from the JSON string to the different functionality (display, sort,export), but not to calculate the values.

    I hope this is a little clearer explained!

    thx an best regards,
    Bernhard

  • allanallan Posts: 61,716Questions: 1Answers: 10,108 Site admin
    Answer ✓

    Hi Bernhard,

    Thanks - I think I see what you mean. You want to be able to do the rendering on the server-side rather than the client-side, and tell the client-side to use that data?

    Yes that is something that should be possible:

    Field::inst( 'myField', 'alias1' ),
    Field::inst( 'myField', 'alias2' )
      ->getFormatter( ... )
    

    basically it will fetch the same field twice and use a formatting function on the second. Personally I'd prefer to do it at the client-side as it will reduce the payload size and the amount of processing that the server has to do.

    Regards,
    Allan

  • belubelu Posts: 38Questions: 14Answers: 0

    Ok thanks allan!
    In between I wrote a own class, that produces the JSON format I wrote in the post above. Now there is a problem with using editor, because on update editor says [[object object]] in the date field. Is there also something like the render function in Datatables for editor? I mean a function, that lets me tell editor, which field of the JSON string should be chosen for displaying the data?

    thx again!

  • belubelu Posts: 38Questions: 14Answers: 0

    thanks, I solved it by assigning the following at editor:
    name: "table_alias.column_name.default",

    best regards!

This discussion has been closed.