|
88 | 88 | <hr class="star-light">
|
89 | 89 | <p>gridstack.js is a jQuery plugin for widget layout. This is drag-and-drop multi-column
|
90 | 90 | grid. It allows you to build draggable responsive bootstrap v3 friendly layouts.
|
91 |
| - It also works great with <a href="http://knockoutjs.com">knockout.js</a></p> |
| 91 | + It also works great with <a href="http://knockoutjs.com">knockout.js</a> and touch devices.</p> |
92 | 92 |
|
93 | 93 | <p>Inspired by <a href="http://gridster.net">gridster.js</a>. Built with love.</p>
|
94 | 94 | </div>
|
@@ -161,61 +161,6 @@ <h3>Basic Usage</h3>
|
161 | 161 |
|
162 | 162 | <p>For more samples and documentation please visit <a href="https://github.com/troolee/gridstack.js">https://github.com/troolee/gridstack.js</a>.</p>
|
163 | 163 |
|
164 |
| - <h3>Use with knockout.js</h3> |
165 |
| - |
166 |
| - <pre><code class="javascript"> |
167 |
| -ko.components.register('dashboard-grid', { |
168 |
| - viewModel: { |
169 |
| - createViewModel: function (params, componentInfo) { |
170 |
| - var ViewModel = function (params, componentInfo) { |
171 |
| - var grid = null; |
172 |
| - |
173 |
| - this.widgets = params.widgets; |
174 |
| - |
175 |
| - this.afterAddWidget = function (items) { |
176 |
| - _.each(items, function (item) { |
177 |
| - item = $(item); |
178 |
| - |
179 |
| - if (grid == null) { |
180 |
| - grid = $(componentInfo.element).find('.grid-stack').gridstack({ |
181 |
| - auto: false |
182 |
| - }).data('gridstack'); |
183 |
| - } |
184 |
| - |
185 |
| - grid.add_widget(item); |
186 |
| - ko.utils.domNodeDisposal.addDisposeCallback(item[0], function () { |
187 |
| - grid.remove_widget(item); |
188 |
| - }); |
189 |
| - }, this); |
190 |
| - }; |
191 |
| - |
192 |
| - }; |
193 |
| - |
194 |
| - return new ViewModel(params, componentInfo); |
195 |
| - } |
196 |
| - }, |
197 |
| - template: [ |
198 |
| - '<div class="grid-stack">', |
199 |
| - ' <!-- ko foreach: widgets, afterRender: afterAddWidget -->', |
200 |
| - ' <div class="grid-stack-item" data-bind="attr: {', |
201 |
| - ' \'data-gs-x\': x,', |
202 |
| - ' \'data-gs-y\': y,', |
203 |
| - ' \'data-gs-width\': width,', |
204 |
| - ' \'data-gs-height\': height', |
205 |
| - ' }">', |
206 |
| - ' <span data-bind="text: $index"></span>', |
207 |
| - ' </div>', |
208 |
| - ' <!-- /ko -->', |
209 |
| - '</div>' |
210 |
| - ].join('\n') |
211 |
| -}); |
212 |
| - </code></pre> |
213 |
| - |
214 |
| - <p>and HTML:</p> |
215 |
| - |
216 |
| - <pre><code class="html"> |
217 |
| -<div data-bind="component: {name: 'dashboard-grid', params: $data}"></div> |
218 |
| - </code></pre> |
219 | 164 | </div>
|
220 | 165 | </section>
|
221 | 166 |
|
|
0 commit comments