This is a migrated thread and some comments may be shown as answers.

Grid With DetailView just once open.

0 Answers 63 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Kim
Top achievements
Rank 1
Kim asked on 27 Jul 2012, 12:17 AM
I use kendoGrid and change Event show detail view.
this code jues work just one time I don't know why.

my code is

<body>

   <div id="example" class="k-content">
   <div id="windowFacets" style="width:100%"></div>
   <!-- // -->

            <div id="grid"></div>
            <div id="test"></div>
  
   <script type="text/x-kendo-template" id="template">
                <div class="toolbar">
                    <label class="category-label" for="category">joindate:</label>
     <input id="start">
     <input id="end">
     <button class="k-button" onclick="refreshGrid()" id="refresh">search</button>
     <button class="k-button" id="excel" onclick="excelGrid()" >excel</button>   
                </div>
            </script>
    
            <script>
    function refreshGrid() {
     $("#grid").data("kendoGrid").dataSource.read();
    }
     
    function excelGrid(){
     
    var form = document.excel;
        form.command.value = "admin03_excel";
        form.start.value = $("#start").val();
        form.end.value = $("#end").val();
        form.action = "<%=RequestUtils.getPageLink(request,"/")%>ActAdmin.do";
        form.submit();
       
    }
    
    
    $(document).ready(function() {
     
                    $("#grid").kendoGrid({
                       dataSource: {
                              transport: {
          read: {
           url: "/ActAdmin.do?command=admin03_json",
           dataType: "json",
           data: { //additional parameters sent to the remote service
            start: function() {
             return $("#start").val();
            },
            end: function() {
             return $("#end").val();
            }
           }
           
         }
                              },
                              schema: {
          data: "rows",
          total: "total",
                                  model: {
                                      fields: {
                                          reg_date :{ type: "string" },
                                          usr_id :{ type: "string" },
                                          biz_name :{ type: "string" },
                                          biz_num :{ type: "string" },
                                          usr_name :{ type: "string" },
                                          reg_date :{ type: "string" },
                                          usr_hp  :{ type: "string" }
                                      }
                                  }
                              },
                              pageSize: 15,
                              serverPaging: true,
                              serverSorting: true,
                              serverFiltering: true
                             
                          },
                          height: 720,
                          filterable: true,
                          sortable: true,
                          pageable: true,
                          selectable: true,
          toolbar: kendo.template($("#template").html()),

          change: function(data){
      
          var text = "";
          var grid = this;
          
             grid.select().each(function() {
                var dataItem = grid.dataItem($(this));
                text = dataItem.usr_id;
                var window = $("#windowFacets");

        window.kendoWindow({
                              actions: ["Close"],
                              width: "780px",
                              height: "620px",
                              content:{
                               url: "/ActAdmin.do?command=admin03_popup",
                               data:{usr_id: function() {return text;}}
                              },
                              modal: true,
                              title: "DetailView"
                          });
                 alert('3');
                 window.data("kendoWindow").open();
             });
      
      },
        columns: [{
                            field:"reg_date",
                            title: "date",
                            filterable: false,
                            sortable: false
                        },
      {
                            field: "usr_id",
                            title: "id"
                        },
                     {
                            field: "biz_name",
                            title: "iz",
                            sortable: false,
       filtertable: false
                           
                        },
                     {
                            field: "biz_num",
                            title: "num",
                            sortable: false
                           
                        },
                     {
                            field: "usr_name",
                            title: "user",
                            filterable: false,
                            sortable: false
                           
                        },
                     {
                            field: "usr_hp",
                            title: "phone",
                            filterable: false,
                            sortable: false
                        },
                     {
                            field: "reg_date",
                            title: "reg_date",
       template: '#= kendo.toString(reg_date,"yyyy-MM-dd") #'
                        }
                    ]
                });

                    function startChange() {
                        var startDate = start.value();

                        if (startDate) {
                            startDate = new Date(startDate);
                            startDate.setDate(startDate.getDate() + 1);
                            end.min(startDate);
                        }
                    }

                    function endChange() {
                        var endDate = end.value();

                        if (endDate) {
                            endDate = new Date(endDate);
                            endDate.setDate(endDate.getDate() - 1);
                            start.max(endDate);
                        }
                    }

                    var start = $("#start").kendoDatePicker({
      value: "<%=(st_year+"-"+st_month+"-"+st_day)%>",
                        change: startChange,
      format: "yyyy-MM-dd"
                    }).data("kendoDatePicker");

                    var end = $("#end").kendoDatePicker({
      value: new Date(),
                        change: endChange,
      format: "yyyy-MM-dd"
                    }).data("kendoDatePicker");

                    start.max(end.value());
                    end.min(start.value());
                });
            </script>
        </div>   
       

No answers yet. Maybe you can help?

Tags
Grid
Asked by
Kim
Top achievements
Rank 1
Share this question
or