Kendo Ui的下拉列表

时间:2019-03-11 08:52:42

标签: javascript php kendo-ui

我有一个包含divisionName的下拉列表,但我希望divisionID在下拉列表中。有人知道吗?

// dropdownList

function divisionDropDownEditor(container, options) {
  $('<input required name="' + options.field + '"/>')
    .appendTo(container)
    .kendoDropDownList({
      autoBind: false,
      dataTextField: "divisionName",
      dataValueField: "divisionID",
      dataSource: {
        type: "POST",
        transport: {
          read: "http://vx-dev.ehors.com:8480/najwa/getDivisionName.php"
        }
      }
    });
}

// getDivisionName.php file


<?php
    ##############################################################
    #### Fetch data from database and display into JSON format ###
    ##############################################################

    $getcheckbox = (isset($_POST['c1']) ? $_POST['c1'] : "all");   // by default select *

    $propertyID="1";
    include("../EHORS.pdo.php");
    $ehorsObj = new EHORS();
    $ehorsObj->EHORS_CONNECT($propertyID);

    $sql = "SELECT  divisionID, divisionName FROM tblAdmDivision";

/*  $sql = "SELECT  tblAdmDepartment.divisionID, tblAdmDivision.divisionName 
            FROM tblAdmDepartment
            INNER JOIN tblAdmDivision
            ON tblAdmDepartment.divisionName = tblAdmDivision.ivisionID";*/

    if ($getcheckbox == "true") {
            $sql .= " WHERE active = 'y' ";
        } 

        //$sql .= " ORDER BY 2 ASC " ;  // ordr by segmentName

    $array = array();   

    // /* PDO */
    $GetResult = $ehorsObj->FetchData($sql, $ehorsObj->DEFAULT_PDO_CONNECTIONS);

    while ($row = $GetResult->fetch()){
            $array[] = $row;
    }


    header("Content-type: application/json");

    $result = json_encode($array);
    echo $result;       

?>

0 个答案:

没有答案