Use a space where * you want to insert a non-database field (for example a counter or static image

Use a space where * you want to insert a non-database field (for example a counter or static image

rbigliazzirbigliazzi Posts: 7Questions: 0Answers: 0
edited January 2013 in General
Hello friends, I wonder if anyone know how to insert the array fields that are not in the databases table. Thanks

Replies

  • allanallan Posts: 63,523Questions: 1Answers: 10,473 Site admin
    Use sDefaultContent or mRender .

    Allan
  • rbigliazzirbigliazzi Posts: 7Questions: 0Answers: 0
    Thanks Allan , but in that way i can mix database fields whit non database fields ?

    Renato
  • allanallan Posts: 63,523Questions: 1Answers: 10,473 Site admin
    Yes - using sDefaultContent or mRender :-). Can you describe a bit more fully what exactly you are trying to do?
  • rbigliazzirbigliazzi Posts: 7Questions: 0Answers: 0
    In my table would have fields that shall come from the database and others that will be generated from routine system, for example, the database fields need name, address, User. And other data fields are filled with routines, this data is not in the database. My doubt is how to accomplish this mix. Example column 1 - name (database) column 2 (non database) column 3 (database) column 4 (non database) column 5 (non database).

    Thanks Allan
  • allanallan Posts: 63,523Questions: 1Answers: 10,473 Site admin
    What kind of routine? If it is derived from the data in the row, use mRender . If it is static data, use sDefaultContent .
  • rbigliazzirbigliazzi Posts: 7Questions: 0Answers: 0
    I've been reading mrender. In the example shown are two elements MDATA and mrender. the MDATA is filled whit the dabatase field? And mrender is generated from a MDATA? Thanks Allan
  • allanallan Posts: 63,523Questions: 1Answers: 10,473 Site admin
    mRender is a simplified version of mData . mData is read / write, mRender is read-only.
  • rbigliazzirbigliazzi Posts: 7Questions: 0Answers: 0
    I use that for connect to database http://www.datatables.net/examples/data_sources/server_side.html
    Allan , you can a example for a situation below ?

    Example column 1 - name (database) column 2 (non database) column 3 (database) column 4 (non database) column 5 (non database).

    Thanks
  • allanallan Posts: 63,523Questions: 1Answers: 10,473 Site admin
    In the examples:

    mRender using derived data: http://datatables.net/release-datatables/examples/advanced_init/column_render.html

    sDefaultContent : http://editor.datatables.net/release/DataTables/extras/Editor/examples/inlineControls.html
  • rbigliazzirbigliazzi Posts: 7Questions: 0Answers: 0
    Look my comments in side

    DataTables init
    $('#example').dataTable( {
    "sDom": "Tfrtip",
    "sAjaxSource": "php/browsers.php",
    "aoColumns": [
    { "mData": "browser" }, THAT DATABASE FIELD CORRECT
    { "mData": "engine" }, THAT DATABASE FIELD CORRECT
    { "mData": "platform" }, THAT DATABASE FIELD CORRECT
    { "mData": "grade", "sClass": "center" }, THAT DATABASE FIELD CORRECT
    {
    "mData": null,
    "sClass": "center",
    "sDefaultContent": 'Edit / Delete' THAT IS NON DATABASE FIELD CORRECT ?
    }
    ]
    } );
    } );

    thanks
  • allanallan Posts: 63,523Questions: 1Answers: 10,473 Site admin
    Correct on all accounts.
  • rbigliazzirbigliazzi Posts: 7Questions: 0Answers: 0
    Allan , see my code, but not worl

    "aColumns": [
    { "mData": "rastreamento" },
    { "mData": "null" },
    { "mData": "null" },
    { "mData": "null" },
    { "mData": "tipo_envio" },
    { "mData": "null" },
    { "mData": "nomedestinatario" },
    { "mData": "pedidooudanfe" },
    { "mData": "null" },
    { "mData": "null" },


    ]
  • essexstephessexsteph Posts: 57Questions: 0Answers: 0
    If that's your code copied and pasted then the last comma before the closing square bracket is incorrect and will stop it working.
This discussion has been closed.