jQWidgets Forums

jQuery UI Widgets Forums Lists ComboBox Why call database tree time?

This topic contains 4 replies, has 2 voices, and was last updated by  inventidea 11 years, 8 months ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
  • Why call database tree time? #30860

    inventidea
    Participant

    When i open page. Why call database tree time?

    The sample is here:

    <!DOCTYPE html>
    <html>
    <head>
    <meta charset="tis-620" />
    <title></title>
    <link rel="stylesheet" href="styles/jqx.base.css"/>
    <script type="text/javascript" src="scripts/jquery-1.10.2.min.js"> </script>
    <script type="text/javascript" src="scripts/jqx-all.js"> </script>
    <script>
    var dataSource = {
    datatype: "json",
    url: "/_base/phpHelpers/CRUD.php",
    data: {
    sFunctionName: "selectTable",
    sFrom: "AccessControlDeviceModel",
    sSelect: "ACDM_ID,ACDM_Name",
    sWhere: "ACDM_ID is not null"
    },
    async: false
    };
    var dataAdapter = new $.jqx.dataAdapter(dataSource);
    $('#fdbACDM_ID').jqxComboBox({source: dataAdapter, displayMember: "ACDM_Name", valueMember: "ACDM_ID"});
    </script>
    <body>
    <fieldset id="fsForm">
    <legend>Device Information</legend>
    <div id="fdbACD_ID" data-type="hidden"></div>
    <table>
    <tr>
    <td class="fieldLabel" style="width: 80px;">Name</td>
    <td>
    <div id="fdbACD_Name" data-type="text" width="150"></div>
    </td>
    <td class="fieldLabel" style="width: 80px;">Description</td>
    <td>
    <div id="fdbACD_Description" data-type="text" width="300"></div>
    </td>
    </tr>
    </table>
    <table>
    <tr>
    <td class="fieldLabel" style="width: 80px;">Location Type</td>
    <td>
    <div id="fdbACDLT_ID" data-type="selector" width="150"></div>
    </td>
    <td class="fieldLabel" style="width: 45px;">Type</td>
    <td>
    <div id="fdbACDT_ID" data-type="selector" width="150" ></div>
    </td>
    <td class="fieldLabel" style="width: 88px;">IsActive</td>
    <td>
    <div id="fdbACD_IsActive" data-type="check" width="90" ></div>
    </td>
    </tr>
    </table>
    <table>
    <tr>
    <td class="fieldLabel" style="width: 80px;">Model</td>
    <td>
    <div id="fdbACDM_ID" data-type="combo" width="151" ></div>
    </td>
    <td class="fieldLabel" style="width: 83px;">IP Address</td>
    <td>
    <div id="fdbACD_IP" data-type="text" width="150" ></div>
    </td>
    <td class="fieldLabel" style="width:55px;">Port</td>
    <td>
    <div id="fdbACD_Port" data-type="text" width="80" ></div>
    </td>
    </tr>
    </table>
    <table>
    <tr>
    <td class="fieldLabel" style="width: 80px;">Setting</td>
    <td>
    <div id="fdbACD_Settings" data-type="text" width="542" height="20" ></div>
    </td>
    </tr>
    </table>
    <table>
    </table>
    </fieldset>
    </body>
    </html>
    Why call database tree time? #30867

    Peter Stoev
    Keymaster

    Hi inventidea,

    Our widgets should be initialized in the jQuery’s document.ready function. Otherwise, you cannot use them. That should be the problem on your page. The ComboBox widget will make just 1 request to your DB if it is initialized as shown in our samples and help documentation.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com

    Why call database tree time? #30881

    inventidea
    Participant

    I’am sorry example first it old. yes, initialized in the document.ready function.
    It’s working but page start combobox call database tree time line. I’am view from “Chrome” -> “Network”

    The new sample is here:

    <!DOCTYPE html>
    <html>
    <head>
    <meta charset="tis-620" />
    <title></title>
    <link rel="stylesheet" href="styles/jqx.base.css"/>
    <script type="text/javascript" src="scripts/jquery-1.10.2.min.js"> </script>
    <script type="text/javascript" src="scripts/jqx-all.js"> </script>
    <script>
    $(document).ready(function(){
    var dataSource = {
    datatype: "json",
    url: "/_base/phpHelpers/CRUD.php",
    data: {
    sFunctionName: "selectTable",
    sFrom: "AccessControlDeviceModel",
    sSelect: "ACDM_ID,ACDM_Name",
    sWhere: "ACDM_ID is not null"
    },
    async: false
    };
    var dataAdapter = new $.jqx.dataAdapter(dataSource);
    $('#fdbACDM_ID').jqxComboBox({source: dataAdapter, displayMember: "ACDM_Name", valueMember: "ACDM_ID"});
    });
    </script>
    <body>
    <fieldset id="fsForm">
    <legend>Device Information</legend>
    <div id="fdbACD_ID" data-type="hidden"></div>
    <table>
    <tr>
    <td class="fieldLabel" style="width: 80px;">Name</td>
    <td>
    <div id="fdbACD_Name" data-type="text" width="150"></div>
    </td>
    <td class="fieldLabel" style="width: 80px;">Description</td>
    <td>
    <div id="fdbACD_Description" data-type="text" width="300"></div>
    </td>
    </tr>
    </table>
    <table>
    <tr>
    <td class="fieldLabel" style="width: 80px;">Location Type</td>
    <td>
    <div id="fdbACDLT_ID" data-type="selector" width="150"></div>
    </td>
    <td class="fieldLabel" style="width: 45px;">Type</td>
    <td>
    <div id="fdbACDT_ID" data-type="selector" width="150" ></div>
    </td>
    <td class="fieldLabel" style="width: 88px;">IsActive</td>
    <td>
    <div id="fdbACD_IsActive" data-type="check" width="90" ></div>
    </td>
    </tr>
    </table>
    <table>
    <tr>
    <td class="fieldLabel" style="width: 80px;">Model</td>
    <td>
    <div id="fdbACDM_ID" data-type="combo" width="151" ></div>
    </td>
    <td class="fieldLabel" style="width: 83px;">IP Address</td>
    <td>
    <div id="fdbACD_IP" data-type="text" width="150" ></div>
    </td>
    <td class="fieldLabel" style="width:55px;">Port</td>
    <td>
    <div id="fdbACD_Port" data-type="text" width="80" ></div>
    </td>
    </tr>
    </table>
    <table>
    <tr>
    <td class="fieldLabel" style="width: 80px;">Setting</td>
    <td>
    <div id="fdbACD_Settings" data-type="text" width="542" height="20" ></div>
    </td>
    </tr>
    </table>
    <table>
    </table>
    </fieldset>
    </body>
    </html>
    Why call database tree time? #30886

    Peter Stoev
    Keymaster

    Hi inventidea,

    I do not know how you track server calls on your side, but I will write it again – the jqxComboBox in jQWidgets 3.0.3 does not make more than 1 server calls. It calls just once the dataAdapter’s dataBind method which makes just one server call. That is demonstrated in all of our online samples available on our website, too. If you wish you may check it: http://www.jqwidgets.com/jquery-widgets-demo/demos/jqxcombobox/bindingtojson.htm?arctic. I suggest you to check your PHP code and check whether you do not make multiple DB calls in the php script.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com

    Why call database tree time? #30899

    inventidea
    Participant

    Hi Peter Stoev,

    Thank you, I check PHP Script good working and i will trail jQWidgets 3.0.3 your guide.
    May i use jQWidgets ver. 2.9.3

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.