jqGrid.php

Gesponsorde koppelingen

PHP script bestanden

  1. jqGrid.php

« Lees de omschrijving en reacties

Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
<?php

// Grid class, used to render JqGrid
class Grid
{
    private $_id;
    private $_altClass;
    private $_altRows;
    private $_autoEncode;
    private $_autoWidth;
    private $_caption;
    private $_columns = array();
    private $_dataType = 'json';
    private $_JsonReader = array('repeatitems' => 'false', 'id' => 0);
    private $_emptyRecords;
    private $_footerRow;
    private $_forceFit;
    private $_gridView;
    private $_headerTitles;
    private $_height;
    private $_hiddenGrid;
    private $_hideGrid;
    private $_hoverRows;
    private $_loadOnce;
    private $_loadText;
    private $_loadUi;
    private $_multiKey;
    private $_multiBoxOnly;
    private $_multiSelect;
    private $_multiSelectWidth;
    private $_onAfterInsertRow;
    private $_onBeforeRequest;
    private $_onBeforeSelectRow;
    private $_onGridComplete;
    private $_onLoadBeforeSend;
    private $_onLoadComplete;
    private $_onLoadError;
    private $_onCellSelect;
    private $_onDblClickRow;
    private $_onHeaderClick;
    private $_onPaging;
    private $_onRightClickRow;
    private $_onSelectAll;
    private $_onSelectRow;
    private $_onSortCol;
    private $_onResizeStart;
    private $_onResizeStop;
    private $_onSerializeGridData;
    private $_page;
    private $_pager;
    private $_pagerPos;
    private $_pgButtons;
    private $_pgInput;
    private $_pgText;
    private $_recordPos;
    private $_recordText;
    private $_requestType;
    private $_resizeClass;
    private $_rowList;
    private $_rowNum;
    private $_rowNumbers;
    private $_rowNumWidth;
    private $_scroll;
    private $_scrollInt;
    private $_scrollOffset;
    private $_scrollRows;
    private $_scrollTimeout;
    private $_shrinkToFit;
    private $_sortName;
    private $_sortOrder;
    private $_topPager;
    private $_toolbar;
    private $_toolbarPosition = 'top';
    private $_searchToolbar;
    private $_searchOnEnter;
    private $_searchClearButton;
    private $_searchToggleButton;
    private $_url;
    private $_viewRecords;
    private $_showAllSortIcons;
    private $_sortIconDirection;
    private $_sortOnHeaderClick;
    private $_width;

        /**
         * Constructor
         * @param string $id Id of grid
         */

        private function __construct($id)
        {

            if (trim($id) === '')
            {

                throw new Exception("Id must contain a value to identify the grid");
            }


            $this->_id = $id;
        }


        /**
         * creates new instance of grid
         * @param string $id Id of grid
         * @return Grid
         */

        public static function create($id)
        {


            return new Grid($id);
        }


        /**
         * Adds column to grid
         * @param Column $colum
         * @return Grid
         */

        public function addColumn(Column $column)
        {

            $this->_columns[] = $column;

            return $this;
        }


        /**
         * The class that is used for alternate rows. You can construct your own class and replace this value.
         * This option is valid only if altRows options is set to true (default: ui-priority-secondary)
         * @param string $altClass Classname for alternate rows
         * @return Grid
         */

        public function setAltClass($altClass)
        {

            $this->_altClass = $altClass;

            return $this;
        }


        /**
         * Set a zebra-striped grid (default: false)
         * @param boolean $altRows Boolean indicating if zebra-striped grid is used
         * @return Grid
         */

        public function setAltRows($altRows)
        {

            $this->_altRows = $altRows;

            return $this;
        }


        /**
         * When set to true encodes (html encode) the incoming (from server) and posted
         * data (from editing modules). For example < will be converted to &lt (default: false)
         * @param boolan indicating if autoencode is used
         * @return Grid
         */

        public function setAutoEncode($autoEncode)
        {

            if (!is_bool($autoEncode))
            {

                throw new Exception('AutoEncode is not a bool');
            }


            $this->_autoEncode = ($autoEncode === true) ? 'true' : 'false';

            return $this;
        }


       /**
         * When set to true, the grid width is recalculated automatically to the width of the
         * parent element. This is done only initially when the grid is created. In order to
         * resize the grid when the parent element changes width you should apply custom code
         * and use a setGridWidth method for this purpose. (default: false)
         * @param boolean $autoWidth indicating if autowidth is used
         * @return Grid
         */

        public function setAutoWidth($autoWidth)
        {

            if (!is_bool($autoWidth))
            {

                throw new Exception('autoWidth is not a bool');
            }


            $this->_autoWidth = ($autoWidth === true) ? 'true' : 'false';

            return $this;
        }


        /**
         * Defines the caption layer for the grid. This caption appears above the header layer.
         * If the string is empty the caption does not appear. (default: empty)
         * @param string $caption Caption of grid
         * @return Grid
         */

        public function setCaption($caption)
        {

            $this->_caption = $caption;

            return $this;
        }


        /**
         * Defines what type of information to expect to represent data in the grid. Valid
         * options are json (default) and xml
         * @param string $dataType Data type
         * @return Grid
         */

        public function setDataType($dataType)
        {

            $this->_dataType = $dataType;

            return $this;
        }


        /**
         * Displayed when the returned (or the current) number of records is zero.
         * This option is valid only if viewrecords option is set to true. (default value is
         * set in language file)
         * @param string $emptyRecords Display string
         * @return Grid
         */

        public function setEmptyRecords($emptyRecords)
        {

            $this->_emptyRecords = $emptyRecords;

            return $this;
        }


        /**
         * If set to true this will place a footer table with one row below the grid records
         * and above the pager. The number of columns equal to the number of columns in the colModel
         * (default: false)
         * @param boolean $footerRow indicating whether footerrow is displayed
         * @return Grid
         */

        public function setFooterRow($footerRow)
        {

            if (!is_bool($footerRow))
            {

                throw new Exception('footerRow is not a bool');
            }


            $this->_footerRow = ($footerRow === true) ? 'true' : 'false';

            return $this;
        }


               /**
         * If set to true, when resizing the width of a column, the adjacent column (to the right)
         * will resize so that the overall grid width is maintained (e.g., reducing the width of
         * column 2 by 30px will increase the size of column 3 by 30px).
         * In this case there is no horizontal scrolbar.
         * Note: this option is not compatible with shrinkToFit option - i.e if
         * shrinkToFit is set to false, forceFit is ignored.
         * @param boolean $forceFit indicating if forcefit is enforced
         * @return Grid
         */

        public function setForceFit($forceFit)
        {

            if (!is_bool($forceFit))
            {

                throw new Exception('forceFit is not a bool');
            }


            $this->_forceFit = ($forceFit === true) ? 'true' : 'false';

            return $this;
        }


          /**
         * In the previous versions of jqGrid including 3.4.X,reading relatively big data sets
         * (Rows >=100 ) caused speed problems. The reason for this was that as every cell was
         * inserted into the grid we applied about 5-6 jQuery calls to it. Now this problem has
         * been resolved; we now insert the entry row at once with a jQuery append. The result is
         * impressive - about 3-5 times faster. What will be the result if we insert all the
         * data at once? Yes, this can be done with help of the gridview option. When set to true,
         * the result is a grid that is 5 to 10 times faster. Of course when this option is set
         * to true we have some limitations. If set to true we can not use treeGrid, subGrid,
         * or afterInsertRow event. If you do not use these three options in the grid you can
         * set this option to true and enjoy the speed. (default: false)
         * @param boolean $gridView
         * @return Grid
         */

        public function setGridView($gridView)
        {

            if (!is_bool($gridView))
            {

                throw new Exception('gridView is not a bool');
            }


            $this->_gridView = ($gridView === true) ? 'true' : 'false';

            return $this;
        }


        /**
         * If the option is set to true the title attribute is added to the column headers (default: false)
         * @param boolean $headerTitles indicating if headertitles are enabled
         * @return Grid
         */

        public function setHeaderTitles($headerTitles)
        {

            if (!is_bool($headerTitles))
            {

                throw new Exception('headerTitles is not a bool');
            }


            $this->_headerTitles = ($headerTitles === true) ? 'true' : 'false';

            return $this;
        }


        /**
         * The height of the grid in pixels (default: 100%, which is the only acceptable percentage for jqGrid)
         * @param in $height Height in pixels
         * @return Grid
         */

        public function setHeight($height)
        {

            if (!ctype_digit((string) $height))
            {

                throw new Exception('Height is not an number');
            }


            $this->_height = $height;

            return $this;
        }


        /**
         * If set to true the grid initially is hidden. The data is not loaded (no request is sent) and only the
         * caption layer is shown. When the show/hide button is clicked for the first time to show the grid, the request
         * is sent to the server, the data is loaded, and the grid is shown. From this point on we have a regular grid.
         * This option has effect only if the caption property is not empty. (default: false)
         * @param boolean $hiddenGrid indicating if hiddengrid is enforced
         * @return Grid
         */

        public function setHiddenGrid($hiddenGrid)
        {

            if (!is_bool($hiddenGrid))
            {

                throw new Exception('hiddenGrid is not a bool');
            }


            $this->_hiddenGrid = ($hiddenGrid === true) ? 'true' : 'false';

            return $this;
        }


        /**
         * Enables or disables the show/hide grid button, which appears on the right side of the caption layer.
         * Takes effect only if the caption property is not an empty string. (default: true)
         * @param boolean indicating if show/hide button is enabled
         * @return Grid
         */

        public function setHideGrid($hideGrid)
        {

            if (!is_bool($hideGrid))
            {

                throw new Exception('hideGrid is not a bool');
            }


            $this->_hideGrid = ($hideGrid === true) ? 'true' : 'false';

            return $this;
        }


        /**
         * When set to false the mouse hovering is disabled in the grid data rows. (default: true)
         * @param boolean $hoverRows Indicates whether hoverrows is enabled
         * @return Grid
         */

        public function setHoverRows($hoverRows)
        {

            if (!is_bool($hoverRows))
            {

                throw new Exception('hoverRows is not a bool');
            }


            $this->_hoverRows = ($hoverRows === true) ? 'true' : 'false';

            return $this;
        }


        /**
         * If this flag is set to true, the grid loads the data from the server only once (using the
         * appropriate datatype). After the first request the datatype parameter is automatically
         * changed to local and all further manipulations are done on the client side. The functions
         * of the pager (if present) are disabled. (default: false)
         * @param boolean $loadOnce indicating if loadonce is enforced
         * @return Grid
         */

        public function setLoadOnce($loadOnce)
        {

            if (!is_bool($loadOnce))
            {

                throw new Exception('loadOnce is not a bool');
            }


            $this->_loadOnce = ($loadOnce === true) ? 'true' : 'false';

            return $this;
        }


        /**
         * The text which appears when requesting and sorting data. This parameter override the value located in the language file
         * @param string Loadtext
         * @return Grid
         */

        public function setLoadText($loadText)
        {

            $this->_loadText = $loadText;

            return $this;
        }


        /**
         *
This option controls what to do when an ajax operation is in progress.
         *
'disable' - disables the jqGrid progress indicator. This way you can use your own indicator.
         *
'enable' (default) - enables

 
 

Om de gebruiksvriendelijkheid van onze website en diensten te optimaliseren maken wij gebruik van cookies. Deze cookies gebruiken wij voor functionaliteiten, analytische gegevens en marketing doeleinden. U vindt meer informatie in onze privacy statement.