Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/377.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 在Kendo UI网格中显示JSON数据_Javascript_Json_Kendo Grid - Fatal编程技术网

Javascript 在Kendo UI网格中显示JSON数据

Javascript 在Kendo UI网格中显示JSON数据,javascript,json,kendo-grid,Javascript,Json,Kendo Grid,嗨,我已经创建了一个html,java脚本。我能够将json数据绑定到剑道UI下拉列表,并能够在Html页面上显示该列表。当选择列表中的任何数据时,我能够检索所选值。现在,我试图用剑道ui网格替换下拉列表,并希望检索选定的行单元格值。下面是剑道代码下拉列表。非常感谢您的帮助 HTML文件 <table style="padding-top: 20px; padding-left: 10px; display: table;" id="selectAccountTable">

嗨,我已经创建了一个html,java脚本。我能够将json数据绑定到剑道UI下拉列表,并能够在Html页面上显示该列表。当选择列表中的任何数据时,我能够检索所选值。现在,我试图用剑道ui网格替换下拉列表,并希望检索选定的行单元格值。下面是剑道代码下拉列表。非常感谢您的帮助

HTML文件

     <table style="padding-top: 20px; padding-left: 10px; display: table;" id="selectAccountTable">        <tbody>
        <tr>
            <td>Existing Account Found</td>
        </tr>
         <tr>
            <td>
              <!--need to display kendo grid UI , kendo drop down  is created at this input 
                <input id="accountSelect" style="width: 350px;">
            </td>
        </tr>

找到现有帐户

好的,问题是什么?是否可以用网格ui替换剑道下拉ui,并将其显示在html页面上。下拉列表显示在输入#Account上,选择如何在那里显示带有姓名、id、城市、邮政编码的网格。我是否需要删除html页面上的输入#accountselect?我想选择网格中的任意一行并检索脚本变量中的值。我可以用下拉列表来做这件事,但不确定网格。
     JavaScript code
      function DisplayActiveAccounts(res)
      {
        var accounts = [];
        var response = $.parseJSON(res);
        for (var idx = 0; idx < response.length; idx++)
        {
        accounts.push({ 'name': response[idx].Name, 'id':  response[idx].Id, 'code': 
           response[idx].Code,'city':response[idx].City,'state':response[idx].State,'ce':response[idx].CE});

        }

        $('#selectAccountTable').show();
        selectAccountVisible = true;
       //need to create kendo ui grid instead of kendo ui drop down list
        $('#accountSelect').kendoDropDownList({
            dataTextField: "name",
            dataValueField: "accountid",

            dataSource: accounts

        });
    }

     function _okClick()
              {
              if (closeWindow) {
            //If the account select table is visible pass back selected  account code
            //need to retrieve the selected row values in returnValues variable
            if (selectAccountVisible) {
                var dropDownSelect = $("#accountSelect").data  ("kendoDropDownList");
                var listData = dropDownSelect.dataSource;
                //Get data from selecte value in drop down
                var selectedData = listData._data.filter(function (account)          { return account.id == dropDownSelect.value() });
                var returnValues = { testID: selectedData[0].id, testCode: selectedData[0].code };

            }
            closeWindow();
            }
             }