Dear admin,
I need to bind Hierarchy grid on main grid by button click. Following is my example code.
My requirement is that the line 114 detailInit: detailInit (responsible for hierarchy grid), should not be there at the time of load of grid. There should be a button, that bind/attach hierarchy grid to main grid on click.
Hiding columns of arrows is not an option.
I need to bind Hierarchy grid on main grid by button click. Following is my example code.
001.var people = new kendo.data.DataSource({002. data: {!Output},003. batch: true,004. schema: {005. model: {006. fields: {007. carId: { type: "string" },008. vehicleId: { type: "string", editable:false },009. Percentage: { type: "number", editable:false },010. Price: { type: "string", editable:false},011. CarType: { type: "string", editable:false},012. CarSize: { type: "string", editable:false},013. CarPerCase: { type: "number", editable:false },014. Family: { type: "string", editable:false},015. ModelType: { type: "string", editable:false},016. EPId: { type: "string" }, 017. Tax: { type: "string" }018. }019. }020. },021. pageSize: 20,022. sort: { field: "vehicleId", dir: "asc" }023. }); 024.var element = $("#grid").kendoGrid({025. dataSource: people,026. navigatable: true,027. pageable: true, 028. toolbar: [029. "save", 030. "cancel",031. {032. name: "Add",033. text: "Show Car Price",034. click: function(e) { 035. return false;036. }037. },038. {039. name: "Delete",040. text: "Hide Car Price",041. click: function(e) { 042. return false;043. }044. }045. ],046. columns:[ 047. {048. field: "carId",049. title: "Car ID",050. width: 150, 051. hidden:true 052. },053. {054. field: "vehicleId",055. title: "Vehicle ID",056. width: 100057. },058. {059. field: "Percentage",060. title: "Percentage",061. width: 70062. },063. {064. field: "Price",065. title: "Price",066. width: 250067. },068. {069. field: "CarType",070. title: "Car Type"071. },072. {073. field: "CarSize",074. title: "Car Size"075. },076. {077. field: "CarPerCase",078. title: "Car Per Case"079. },080. {081. field: "Family",082. title: "Family"083. },084. {085. field: "ModelType",086. title: "Model Type",087. width: 100088. },089. {090. field: "EPId",091. title: "EP Id",092. hidden: false093. }, 094. {095. field: "Tax",096. title: "Tax",097. format: "{0:c}",098. width: 100099. }100. ], 101. editable:true, 102. groupable: true, 103. filterable: true, 104. sortable: true,105. reorderable: true,106. resizable: true,107. columnMenu: true, 108. pageable: {109. refresh: true,110. pageSizes: [10, 20, 50],111. buttonCount: 5112. },113. editable: "incell", 114. detailInit: detailInit 115. });116.// hierarchy grid117. function detailInit(e) { 118. var detailRow = e.detailRow;119. codeDetailData = e.data;120. 121. $("<div/>").appendTo(e.detailCell).kendoGrid({ 122. dataSource: e.data.ItemPrices.toJSON(), 123. editable:true,124. navigatable: true,125. scrollable: false,126. sortable: true,127. pageable: true,128. columns: [129. { 130. field: "Engine", 131. width: "200px",132. editor: serviceItemAutoCompleteEditor 133. },134. { 135. field: "TN", 136. title:"TN", 137. width: "110px"138. },139. { 140. field: "TaxApplied", 141. title:"Tax Applied"142. },143. { 144. field: "TaxChange", 145. title: "Tax Change", 146. width: "300px"147. },148. { 149. field: "StartDate", 150. title: "Start Date",151. format:"{0:dd-MM-yyyy}", 152. editor: dateTimeEditor 153. },154. { 155. field: "EndDate", 156. title: "End Date",157. format:"{0:dd-MM-yyyy}", 158. editor: dateTimeEditor 159. }160. ]161. });162. 163. }My requirement is that the line 114 detailInit: detailInit (responsible for hierarchy grid), should not be there at the time of load of grid. There should be a button, that bind/attach hierarchy grid to main grid on click.
Hiding columns of arrows is not an option.