Quantcast
Channel: Editor — DataTables forums
Viewing all articles
Browse latest Browse all 3744

Field Set Value from a different location

$
0
0

This calls out a computer name:

    var url = "/api/cdi_master/GetLogin";

        $.get(url, null, function (data) {
           $("#rData").val(data);

        });

Right now it passes to a location on my page but I would also like it to pass the value to User field in the editor below.

This is my editor code:

 var editor; // use a global for the submit and return data rendering in the examples

        $(document).ready(function () {

            editor = new $.fn.dataTable.Editor({
                "ajax": "/api/cdi_master",
                "table": "#example",
                "fields": [
        {

            label: "<div background-color=#004d99; layer-background-color:#004d99><b>Show Form Action:</b></font>",

                    name: "options",

            type: "radio",

            options: [ "Billing Status Only", "Add Reconciliation" ],
            def: "Billing Status Only"
        },
       {
           label: "Billing Status:",
           name: "cdi_details.billing_status",
           value: "cdi_billing_status.id",
           type: "radio"
       },

        { label: "Audit Status",
        name: "cdi_details.audit_status",
        value: "cdi_audit_status.id",
        type: "radio"
},

    {
        label: "User",
        name: "User"

    },

     {
         label: "Insurance:",
         name: "cdi_details.insurance_id",
         value: "cdi_insurance.id",
         type: "select"
     },
         {
             label: "Amount Billed",
             name: "cdi_details.amount_billed",
             def: "0.00"

         },
        {
             label: "Amount Received",
             name: "cdi_details.amount_received",
            def: "0.00"

        },
        {
            label: "Date Mailed",
            name: "cdi_details.date_mailed",
        type: "date",
         def: "00/00/0000"
        },
        {
                label: "Optional Comments",
            name: "cdi_details.comment",
            type: "textarea"

        },

                ]
            });



            editor.dependent('options', function (val) {

                return val === 'Add Reconciliation' ?

            { show: ['cdi_details.insurance_id', 'cdi_details.amount_billed', 'cdi_details.amount_received', 'cdi_details.date_mailed'] } :
        { hide: ['cdi_details.insurance_id', 'cdi_details.amount_billed', 'cdi_details.amount_received', 'cdi_details.date_mailed'] }




                ;
        } );

Edited by Allan - Syntax highlighting. Details on how to highlight code using markdown can be found in this guide.


Viewing all articles
Browse latest Browse all 3744

Trending Articles