2014-09-23 2 views
0

저는 처음으로 bootstrap입니다. 우리 UI는 모두 KendoGrid's입니다.KendoGrid in bootstrap

켄드 그리드를 부트 스트랩의 Modal Window 내에 넣고 싶습니다. Kendo Grid in Bootstrap 2 or 3 Modal - IE Filters do not work에 게시 된 코드를 사용해 보았습니다. 그러나 여기에서 close 버튼과 header은 모달 창을 벗어나 이상하게 보입니다. 나는 그것이 부트 스트랩 CSS 버전 때문이라고 생각한다. bootstrap_2.3.2.min.css으로 시도한 경우이 문제가 해결되었습니다. 하지만 v3.2.0을 사용해야합니다. 이에 대한 해결책이 있으면 알려주십시오.

http://jsbin.com/yiyon

<div class='modal fade' id='myModal'> 
    <div class='modal-header'> 
     <button type='button' class='close' data-dismiss='modal' aria-hidden='true'>&times;</button> 
     <h3><strong>$heading</strong></h3> 
    </div> 
    <div class='modal-body'> 
     <div id="grid"></div> 
    </div> 
</div> 

<script> 
    var products = [{ 
     ProductID: 1, 
     ProductName: "Chai", 
     SupplierID: 1, 
     CategoryID: 1, 
     QuantityPerUnit: "10 boxes x 20 bags", 
     UnitPrice: 18.0000, 
     UnitsInStock: 39, 
     UnitsOnOrder: 0, 
     ReorderLevel: 10, 
     Discontinued: false, 
     Category: { 
      CategoryID: 1, 
      CategoryName: "Beverages", 
      Description: "Soft drinks, coffees, teas, beers, and ales" 
     }, 
     popupPermission: true, 
     somethingElsePermission: false 
    }, { 
     ProductID: 2, 
     ProductName: "Chang", 
     SupplierID: 1, 
     CategoryID: 1, 
     QuantityPerUnit: "24 - 12 oz bottles", 
     UnitPrice: 19.0000, 
     UnitsInStock: 17, 
     UnitsOnOrder: 40, 
     ReorderLevel: 25, 
     Discontinued: false, 
     Category: { 
      CategoryID: 1, 
      CategoryName: "Beverages", 
      Description: "Soft drinks, coffees, teas, beers, and ales" 
     }, 
     popupPermission: true, 
     somethingElsePermission: true 
    } 
    ]; 

    columnsettings = [ 
      "ProductName", 
      { 
       field: "UnitPrice", 
       title: "Unit Price", 
       format: "{0:c}", 
       width: "130px" 
      }, 
      { 
       field: "UnitsInStock", 
       title: "Units In Stock", 
       width: "130px" 
      }, 
      { 
       field: "Discontinued", 
       width: "130px" 
      } 
    ]; 

    var gridDataSource = new kendo.data.DataSource({ 
     data: products, 
     schema: { 
      model: { 
       id: "uid", 
       fields: { 
        ProductName: { type: "string" }, 
        UnitPrice: { type: "number" }, 
        UnitsInStock: { type: "number" }, 
        Discontinued: { type: "boolean" } 
       } 
      } 
     }, 
     sort: { 
      field: "", 
      dir: "desc" 
     }, 
     pageSize: 50 
    }); 



    $(document).on('click', '#openModal', function() { 
     $('#myModal').modal('show'); 
     if (!$('#grid').data('kendoGrid')) { 
      createGrid(); 
     } 
    }); 

    function createGrid() { 
     $('#grid').kendoGrid({ 
      dataSource: gridDataSource, 
      scrollable: true, 
      reorderable: true, 
      resizable: true, 
      pageable: { 
       refresh: true, 
       pageSizes: [50, 100, 200] 
      }, 

      filterable: { 
       extra: false, 
       operators: { 
        string: { 
         contains: "Contains", 
         startswith: "Starts with" 
        }, 
        number: { 
         lt: "Is less than", 
         eq: "Is equal to", 
         gt: "Is greater than" 
        }, 
        date: { 
         lt: "Is less than", 
         eq: "Is equal to", 
         gt: "Is greater than" 
        } 
       } 
      }, 
      sortable: { 
       mode: "single", 
       allowUnsort: false 
      } 
     }); 
    } 

</script> 

답변

1

는 사실, 당신이 두 개 더 divs와 내용을 포함 잊어 버린는 :

+0

http://jsbin.com/hujomaxituqo/1/가 널이 궁금해 감사합니다

<div class='modal fade' id='myModal'> <div class='modal-dialog'> <!-- First div for setting the dialog --> <div class='modal-content'> <!-- Second div for setting the content --> <div class='modal-header'> <button type='button' class='close' data-dismiss='modal' aria-hidden='true'>&times;</button> <h3><strong>$heading</strong></h3> </div> <div class='modal-body'> <div id="grid"></div> </div> </div> </div> </div> 

나는 당신의 jsbin를 업데이트 그것은 이전 버전과 함께 작동했습니다 .. – Interstellar

+0

당신은 오래된 문서를 볼 수 있습니다 : http://getbootstrap.com/2.3.2/javascript.html#modals -> v2.3.2와 v3.2.0 사이에서 업데이트 된 마크 업 ... –

+0

이 내용 (및 기타 많은 변경 사항)은 부트 스트랩의 2-> 3 마이그레이션 문서에서도 다룹니다. http://getbootstrap.com/migration/ – cvrebert

관련 문제