2013-02-08 2 views
0

나는 검도 UI와 초보자를 초보자로 웹 개발을하고 있습니다 ... 어제 태어났습니다. :). 내 질문을 농담하는 것은 정말로 질문이 아닙니다. 특정 질문에 대한 포럼 규칙을 알고 있지만 도움이 필요합니다.검도 UI 뮤직 스토어의 변형 예가 작동하지 않습니다

내 문제는 이것이다 :

내가 검도 UI MVC 뮤직 스토어 자습서를 적용하지만, 사용 MVC ASP.net (I 델파이 작업)과없는 작품. Category.js이

(function (window, $, kendo) { 
    var getCategAsync = function() { 
    var deferred = $.Deferred(),  
     translateCateg = function (data) { 
      deferred.resolve($.map(data.result, function(item) { 
      return { 
       value: item.ID, 
       text: item.Description 
      }; 
      })); 
     }, 
     loadCateg = function() { 
      new kendo.data.DataSource({ 
      type: "json", 
      transport: { 
       read: "/w/Category?select=ID,Description" 
      }, 
      schema: { 
       data: 'result'/*, 
         total: store.config.wcfSchemaTotal*/ 
      } 
      }).fetch(function (data) { 
      translateCateg(data); 
      }); 
     }; 
    window.setTimeout(loadCateg, 1); 
    return deferred.promise(); 
    }; 
    var getLangAsync = function() { 
    var deferred = $.Deferred(), 

     translateLang = function (data) { 
      deferred.resolve($.map(data.result, function(item) { 
      return { 
       value: item.ID, 
       text: item.Description 
      }; 
      })); 
     }, 
    loadLang = function() { 
     new kendo.data.DataSource({ 
     type: "json", 
     transport: { 
      read: "/w/Language?select=ID,Description" 
     }, 
     schema: { 
      data: 'result'/*, 
         total: store.config.wcfSchemaTotal*/ 
     } 
     }).fetch(function (data) { 
     translateLang(data); 
     }); 
    }; 
    window.setTimeout(loadLang, 1); 
    return deferred.promise(); 
    }; 
    var initGrid = function (categs, langs, categEditor, langEditor) { 
    $("#categGrid").kendoGrid({ 
     sortable: true, 
     groupable: false, //true, 
     filterable: false, //true, 
     pageable: true, 
     editable: "inline", 
     toolbar: ["create"], 
     dataSource: { 
     type: "json", 
     pageSize: 10, 
     serverPaging: false, //true, 
     serverFiltering: false, //true, 
     serverSorting: false, //true, 
     sort: { field: "SortOrder", dir: "asc" }, 
      transport: { 
      type: "json", 
      read: { 
       url: "/w/Category?select=ID,Description", 
       type: "GET" 
      }/*, 
       update: { 
        url: function (data) { 
        return store.config.albumsUrl + "(" + data.AlbumId + ")" 
        }, 
        type: "PUT" 
       }, 
       destroy: { 
        url: function (data) { 
        return store.config.albumsUrl + "(" + data.AlbumId + ")"; 
        }, 
        type: "DELETE" 
       }, 
       create: { 
        url: store.config.albumsUrl, 
        type: "POST" 
       } */ 
      }, 
      schema: { 
      data: "result", 
      //total: store.config.wcfSchemaTotal, 
      model: { 
       id: "ID", 
       fields: { 
       ID: { type: "number" }, 
       Description: { type: "string", validation: {required: true} }, 
       Language: { type: "number", defaultValue: 1 }, 
       SortOrder: { type: "number", defaultValue: 0 }, 
       Status: { type: "number", defaultValue: 0 }, 
       Parent: { type: "number", defaultValue: 0 } 
       } 
      } 
      }, 
     }, 

      columns: [ 
       { field: "ID", title: "ID", editable: false, filterable: false, width: 20 }, 
       { field: "Description", title: "Descripción", filterable: false, width: 150 }, 
       { field: "Language", title: "Idioma", values: langs, editor: langEditor, filterable: false, width: 50 }, 
       { field: "SortOrder", title: "Orden", filterable: false, width: 20 }, 
       { field: "Status", title: "Estado", filterable: false, width: 50 }, 
       { field: "Parent", title: "Subcategoría de", values: categs, editor: categEditor, filterable: false, width: 150 }, 
       { command: ["edit", "destroy"], title: " ", width: "160px" } 
      ] 
     }); 
    }; 
    // Wait for both the genres and artists lists to load. 
    $.when(getCategAsync(), getLangAsync()) 
    .done(function(categs, langs) { 
     var categEditor = function (container, options) { 
     $('<input data-text-field="text" data-value-field="value" data-bind="value:' + options.field + '" />') 
        .appendTo(container) 
        .kendoComboBox({ 
         autoBind: false, 
         dataSource: categs 
        }); 
      }; 
     var langEditor = function (container, options) { 
     $('<input data-text-field="text" data-value-field="value" data-bind="value:' + options.field + '" />') 
      .appendTo(container) 
      .kendoComboBox({ 
      autoBind: false, 
      dataSource: langs 
      }); 
     }; 
     initGrid(categs, langs, categEditor, langEditor); 
    }); 
})(window, jQuery, kendo);      

나는이 아무것도 실행되지이 표시되어

Category.html

<!DOCTYPE html> 
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="es" lang="es"> 
    <head> 
     <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 

     <title>Administración de Categorías</title> 

     <link href="kendo/styles/kendo.common.min.css" rel="stylesheet" type="text/css" /> 
     <link href="kendo/styles/kendo.default.min.css" rel="stylesheet" type="text/css" /> 

     <link rel="stylesheet" href="css/menuvir.css" type="text/css"/> 

     <script src="kendo/js/jquery.min.js" type="text/javascript"></script> 
     <script src="kendo/js/kendo.web.min.js" type="text/javascript"></script> 

    </head> 

    <body> 

     <div id="categGrid"></div> 

     <script src="js/category.js type="text/javascript"></script>  

    </body> 
    </html> 

및 방화범에 오류 :

나는 두 개의 파일이 콘솔.

무엇이 잘못 되었나요? 어떤 도움이 감사합니다.

미리 감사드립니다. 제 영어는 유감 스럽습니다.

UPDATE

미안 해요, 난 여기 Category.html 코드를 업데이트 잊었지만 난 항상 값 권리 "ID"를했고 아직 없습니다 작동합니다. 빠른 답변 감사합니다.

답변

0

찾을 것

$("#grid").kendoGrid({ 

을 의미했다. 내가 잘못 적용한 몇 가지 옵션을 변경했습니다.

이것은 작동하는 코드입니다.

(function (window, $, kendo) { 
    var getCategAsync = function() { 
     var deferred = $.Deferred(), 

      translateCateg = function (data) { 
       deferred.resolve($.map(data.items, function(item) { 
        return { 
         value: item.ID, 
         text: item.Description 
        }; 
       })); 
      }, 

      loadCateg = function() { 
       new kendo.data.DataSource({ 
        transport: { 
         read: { 
         url: "/w/Category?select=ID,Description", 
         dataType: "json", 
         type: "GET" 
         } 
        }, 
        schema: { 
         data: 'result'/*, 
         total: store.config.wcfSchemaTotal*/ 
        } 
       }).fetch(function (data) { 
        translateCateg(data); 
       }); 
      }; 

     window.setTimeout(loadCateg, 1); 
     return deferred.promise(); 
    }; 

    var getLangAsync = function() { 
     var deferred = $.Deferred(), 

      translateLang = function (data) { 
       deferred.resolve($.map(data.items, function(item) { 
        return { 
         value: item.ID, 
         text: item.Description 
        }; 
       })); 
      }, 

      loadLang = function() { 
       new kendo.data.DataSource({ 
        transport: {      
         read: { 
         url: "/w/Language?select=ID,Description", 
         dataType: "json", 
         type: "GET" 
         } 
        }, 
        schema: { 
         data: 'result'/*, 
         total: store.config.wcfSchemaTotal*/ 
        } 
       }).fetch(function (data) { 
        translateLang(data); 
       }); 
      }; 

     window.setTimeout(loadLang, 1); 
     return deferred.promise(); 
    }; 

    var initGrid = function (categs, langs, categEditor, langEditor) { 
     $("#categGrid").kendoGrid({ 
      sortable: true, 
      groupable: false, //true, 
      filterable: false, //true, 
      pageable: true, 
      editable: "inline", 
      toolbar: ["create"], 

      dataSource: { 
       type: "json", 
       pageSize: 10, 
       serverPaging: false, //true, 
       serverFiltering: false, //true, 
       serverSorting: false, //true, 
       sort: { field: "SortOrder", dir: "asc" }, 
       transport: {     
        read: { 
         url: "/w/Category?select=*", 
         type: "GET", 
         dataType: "json" 
        }/*, 
        update: { 
         url: function(data) { 
         return "/w/Category?ID=" + data.ID; 
         }, 
         contentType: "application/json", 
         type: "PUT" 
        }, 
        destroy: { 
         url: function (data) { 
          return store.config.albumsUrl + "(" + data.AlbumId + ")"; 
         }, 
         type: "DELETE" 
        }, 
        create: { 
         url: store.config.albumsUrl, 
         type: "POST" 
        } */ 
       }, 
       schema: { 
        data: "result", 
        total: function(response) { 
        return response.result.length; 
        }, 
        model: { 
         id: "ID", 
         fields: { 
          ID: { type: "number" }, 
          Description: { type: "string", validation: {required: true} }, 
          Language: { type: "number", defaultValue: 1 }, 
          SortOrder: { type: "number", defaultValue: 0 }, 
          Status: { type: "number", defaultValue: 0 }, 
          Parent: { type: "number", defaultValue: 0 } 
         } 
        } 
       }, 
      }, 

      columns: [ 
       { field: "ID", title: "ID", editable: false, filterable: false, width: 20 }, 
       { field: "Description", title: "Descripción", filterable: false, width: 150 }, 
       { field: "Language", title: "Idioma", values: langs, editor: langEditor, filterable: false, width: 50 }, 
       { field: "SortOrder", title: "Orden", filterable: false, width: 20 }, 
       { field: "Status", title: "Estado", filterable: false, width: 50 }, 
       { field: "Parent", title: "Subcategoría de", values: categs, editor: categEditor, filterable: false, width: 150 }, 
       { command: ["edit", "destroy"], title: "&nbsp;", width: "160px" } 
      ] 
     }); 
    }; 

    // Wait for both the genres and artists lists to load. 
    $.when(getCategAsync(), getLangAsync()) 
     .done(function(categs, langs) { 
      var categEditor = function (container, options) { 
       $('<input data-text-field="text" data-value-field="value" data-bind="value:' + options.field + '" />') 
        .appendTo(container) 
        .kendoComboBox({ 
         autoBind: false, 
         dataSource: categs 
        }); 
      }; 

      var langEditor = function (container, options) { 
       $('<input data-text-field="text" data-value-field="value" data-bind="value:' + options.field + '" />') 
        .appendTo(container) 
        .kendoComboBox({ 
         autoBind: false, 
         dataSource: langs 
        }); 
      }; 

      initGrid(categs, langs, categEditor, langEditor); 
     }); 
})(window, jQuery, kendo);      

감사합니다.

0

글쎄, 당신의 JQuery와 당신의 HTML에서 아무것도 일치하지 않는 HTML

$("#categGrid").kendoGrid( 

에 존재하지 않은 ID에 KendoGrid을 만들려고 우선합니다. 당신은 내가이 문제를 해결

<div id="grid"></div> 
관련 문제