PFZ.nl - PHP Community: Menu click wel in FF, IE8 maar niet in IE7 - Frontend - Forum - PFZ.nl - PHP Community

Je kunt niet antwoorden op dit topic
#1 22-02-2012 20:58
Hallo,

Ik heb een probleem met het volgende.
Mijn code geeft geen foutmeldingen, maar als ik de compatibiliteitfuncties aanzet in IE8, of de site in IE7 laat draaien, dan werkt het klikken op de links niet.
(
<a id="9999" class="addnewsqlcolumn" href="#">[Click to a add new column]..</a>
[Click to a add new condition]..
[Click to a add new group column]..
[Click to a add new sort column]..
)

De links die in het treeview gedeelte staan werken wel, en de gegevens worden dan ook aangepast, maar ik kan dus niets nieuws aanmaken.
Er zou een menu moeten verschijnen, maar dat gebeurd dus niet, en ik snap niet waarom niet.

Mijn html bestand:
(Maakt gebruik van jquery 1.7.1)

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
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml"><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>SQL builder test</title>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="jquery.sqlbuilder.js"></script>
<link rel="stylesheet" type="text/css" href="jquery.sqlbuilder.css" />
</head>
<body>
<table border="0" width="100%">
    <tr>
        <td valign="top">
           <div id="sqlreport">
                <table border="0">
                    <tr>
                        <td valign="top" width="15%">
                            <p id="filelist"></p>
                           </td>
                        <td width="50%">
                            <div class="sqlbuild"></div>
                        </td>
                        <td width="35%" style="padding-left: 20px;" valign="top">
                            DISTINCT - A keyword that returns only unique rows within a result set<br />
                            COUNT - A function that returns a numeric value which equals the number of rows matching your query<br />
                            AVG - A function that returns the numeric value that equals the average of the numbers in a specified column<br />
                            SUM - A function that adds the numbers in a specified column<br />
                            MIN - A function that returns the lowest non-null value in a column<br />
                            MAX - A function that returns the largest value in a column<br /><br />Example:<br />X Total as  Total:sum(%f) <br /><br />Created Query:<br /><p id="x"></p></td></tr></table></div>
        </td>
        <td valign="top" align="left"></td>
    </tr>
    <tr>
        <td colspan="2"><p id="q"></p></td>
    </tr>
    <tr>
        <td colspan="2"><p id="y"></p><br /><p id="w"></p></td>
    </tr>
    <tr>
        <td colspan="2"><a id="z" href="#">Run SQL</a></td>
    </tr>
    <tr>
        <td colspan="2"><a id="u" href="#">Get Clause</a></td>
    </tr>
</table>
<table border="0" width="100%">
    <tr>
        <td colspan="2">Query Result (Limited by 30 results):<br /><p id="v"></p></td>
    </tr>
</table>
<script type="text/javascript">
$(document).ready(function() 
{ 
    $('.sqlbuild').sqlquerybuilder({ 
        fields:[ 
             {field:'-',                                        name:'Inventory >',                 id:0,ftype:'{',defaultval:'-'}, 
             {field:'Card_Call_Detail.DB_CALL_ID',                name:'DB_CALL_ID',                     id:1,ftype:'string',defaultval:'1'}, 
             {field:'Card_Call_Detail.invoice_number',            name:'invoice_number',                id:2,ftype:'string',defaultval:'2' }, 
             {field:'Card_Call_Detail.invoice_date',            name:'invoice_date',                 id:3,ftype:'string',defaultval:'3'},
             {field:'Card_Call_Detail.page_number',                name:'page_number',                 id:4,ftype:'string',defaultval:'4'},
             {field:'Card_Call_Detail.corporation_id',            name:'corporation_id',                 id:5,ftype:'string',defaultval:'5'},
             {field:'Card_Call_Detail.bill_payer',                name:'bill_payer',                     id:6,ftype:'string',defaultval:'6'},
             {field:'Card_Call_Detail.node_no',                    name:'node_no',                     id:7,ftype:'string',defaultval:'7'},
             {field:'Card_Call_Detail.account_number',            name:'account_number',                 id:8,ftype:'string',defaultval:'8'}, 
             {field:'Card_Call_Detail.card_number',                name:'card_number',                    id:9,ftype:'string',defaultval:'9'}, 
             {field:'Card_Call_Detail.ID_Accounting_Code',        name:'ID_Accounting_Code',             id:10,ftype:'string',defaultval:'10'},
             {field:'Card_Call_Detail.ID_Description',            name:'ID_Description',                 id:11,ftype:'string',defaultval:'11'},
             {field:'Card_Call_Detail.Date_called',                name:'Date_called',                 id:12,ftype:'string',defaultval:'12'},
             {field:'Card_Call_Detail.Time_called',                name:'Time_called',                 id:13,ftype:'string',defaultval:'13'},
             {field:'Card_Call_Detail.Number_Dialed',            name:'Number_Dialed',                 id:14,ftype:'string',defaultval:'14'},
             {field:'Card_Call_Detail.Type',                    name:'Type',                         id:15,ftype:'string',defaultval:'15'}, 
             {field:'Card_Call_Detail.Number_Called',            name:'Number_Called',                id:16,ftype:'string',defaultval:'16'}, 
             {field:'Card_Call_Detail.Place_Called',            name:'Place_Called',                 id:17,ftype:'string',defaultval:'17'},
             {field:'Card_Call_Detail.Place_Called_STATE',        name:'Place_Called_STATE',             id:18,ftype:'string',defaultval:'18'},
             {field:'Card_Call_Detail.Oper',                    name:'Oper',                         id:19,ftype:'string',defaultval:'19'},
             {field:'Card_Call_Detail.Data',                    name:'Data',                         id:20,ftype:'string',defaultval:'20'},
             {field:'Card_Call_Detail.NCP',                        name:'NCP',                         id:21,ftype:'string',defaultval:'21'},
             {field:'Card_Call_Detail.Minutes_Called',            name:'Minutes_Called',                 id:22,ftype:'string',defaultval:'22'}, 
             {field:'Card_Call_Detail.Network',                    name:'Network',                        id:23,ftype:'string',defaultval:'23'}, 
             {field:'Card_Call_Detail.Rate',                    name:'Rate',                         id:24,ftype:'string',defaultval:'24'},
             {field:'Card_Call_Detail.Feature',                    name:'Feature',                     id:25,ftype:'string',defaultval:'25'},
             {field:'Card_Call_Detail.Payphone_Use_Charge',        name:'Payphone_Use_Charge',         id:26,ftype:'string',defaultval:'26'},
             {field:'Card_Call_Detail.Surcharge',                name:'Surcharge',                     id:27,ftype:'string',defaultval:'27'},
             {field:'Card_Call_Detail.Total',                    name:'Total',                         id:28,ftype:'string',defaultval:'28'},            
             {field:'Card_Call_Detail.Called_From_Place',        name:'Called_From_Place',             id:29,ftype:'string',defaultval:'29'},
             {field:'Card_Call_Detail.Called_From_Place_STATE',    name:'Called_From_Place_STATE',     id:30,ftype:'string',defaultval:'30'},
             {field:'Card_Call_Detail.Originating_Number',        name:'Originating_Number',             id:31,ftype:'string',defaultval:'31'}
           ],
        reportid:'9000',
        sqldiv: $('p#x'),
        presetlistdiv: $('p#filelist'),
        reporthandler:'reporthandler.php',
        datadiv:$('p#q'),
        statusmsgdiv:$('p#w'),        
        showgroup:true,
        showcolumn:true,
        showsort:true,
        showwhere:true,
        joinrules:[],
        onchange:function(type){
                      //alert('sqlbuilder:'+type);    
                 },
        
        onselectablelist:function(slotid,fieldid,operatorid,chainid){
                          var vals='XX,YY,ZZ';//+slotid+','+fieldid+','+operatorid+','+chainid; 
                          switch(fieldid){
                          
                            case '3'://invcards unit
                               vals += 'UN,KG,GR,TN';                             
                            break;   
                          
                          
                          }                          
                          return vals;
                         }
        
    }); 

    $('a#z').click(function(){
      $.ajax({    
            type:    'POST',    
            url:     'query.php',   
            data:    'querytorun='+$('p#x').html() + ' LIMIT 0, 30',    
            error:   function(){ $('p#v').html("Can run sql"); },    
            success: function(data) { $('p#v').html(data);}    
        });             
     return false;
    }); 

    $('a#u').click(function(){
     alert($('.sqlbuild').getSQBClause('all')); 
     return false;
    }); 
});
</script>
</body>
</html>


En hier de jquery.sqlbuilder.js
Het probleem zit denk ik niet in de simpletreeview, maar wel in functie: sqlquerybuilder als ik het goed begrijp...

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
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
(function ($) {
    $.fn.sqlsimpletreeview = function (options) {
        $.fn.sqlsimpletreeview.defaults = {
            name: 'mytree',
            onselect: null
        };
        var opts = $.extend({}, $.fn.sqlsimpletreeview.defaults, options);
        return this.each(function () {
            this.opts = opts;
            var tree = $(this);
            tree.find('ul.treeview li.list').addClass('expanded').find('>ul').toggle();
            tree.click(function (e) {
                var node = $(e.target);
                if (node.is("li.list")) {
                    if (node.hasClass('collapsed')) {
                        node.find('>ul').toggle();
                        node.removeClass('collapsed').addClass('expanded');
                    } else if (node.hasClass('expanded')) {
                        node.find('>ul').toggle();
                        node.removeClass('expanded').addClass('collapsed');
                    }
                    e.stopPropagation();
                } else if (node.attr('href') === '#' || node.hasClass('item')) {
                    opts.onselect(node);
                }
            });
        });
    };

    $.fn.extend({
        getSQBClause: function (ctype) {
            var tt = this[0];
            switch (ctype) {
            case 'where':
                return $('.sqlwheredata', $(tt)).text();
            case 'sort':
                return $('.sqlsortdata', $(tt)).text();
            case 'group':
                return $('.sqlgroupbydata', $(tt)).text();
            case 'column':
                return $('.sqlcolumndata', $(tt)).text();
            case 'all':
                return $('.sqlalldata', $(tt)).text();
            }
        },
        getSQBParam: function (prm) {
            var $tt = this[0];
            if (!prm) {return $tt.opts; } else { return ($tt.opts[prm] ? $tt.opts[prm] : null); }
        },
        setSQBParam: function (newprms) {
            return this.each(function () {
                if (typeof (newprms) === "object") {
                    $.extend(true, this.opts, newprms);
                }
            });
        },
        loadSQB: function (jsonstr) {
            var $tt = this[0], j = '', coldiv = '', sortdiv = '', groupdiv = '', wherediv = '', i = 0;
            $('.sqlcolumn, .sqlwhere, .sqlgroup, .sqlsort').remove();
            j = $.parseJSON(jsonstr);
            coldiv = $('.addnewsqlcolumn');
            sortdiv = $('.addnewsqlsort');
            groupdiv = $('.addnewsqlgroup');
            wherediv = $('.addnewsqlwhere');
            for (i = 0; i < j.columndata.length; i++) {
                coldiv[0].opts.onselect(j.columndata[i].columnslot, coldiv, {
                    columnas: j.columndata[i].columnas
                });
            }
            for (i = 0; i < j.sortdata.length; i++) {
                sortdiv[0].opts.onselect(j.sortdata[i].columnslot, sortdiv, {
                    columnas: j.sortdata[i].columnas
                });
            }
            for (i = 0; i < j.groupdata.length; i++) {
                groupdiv[0].opts.onselect(j.groupdata[i].columnslot, groupdiv, null);
            }
            for (i = 0; i < j.wheredata.length; i++) {
                wherediv[0].opts.onselect(j.wheredata[i].columnslot, wherediv, {
                    columnslot: j.wheredata[i].columnslot,
                    opslot: j.wheredata[i].opslot,
                    chainslot: j.wheredata[i].chainslot,
                    columnvalue: j.wheredata[i].columnvalue
                });
            }
        }
    });

    var mouseX = 0,
        mouseY = 0;
    $().mousemove(function (e) {
        mouseX = e.pageX;
        mouseY = e.pageY;
    });

    $.fn.sqlsimplemenu = function (options) {
        $.fn.sqlsimplemenu.defaults = {
            menu: 'kmenu',
            mtype: 'menu',
            menuid: 0,
            checkeditems: '',
            checkalltext: 'Select all',
            onselect: null,
            onselectclose: null,
            onselectablelist: null,
            oncheck: null,
            fields: []
        };
        var opts = $.extend({}, $.fn.sqlsimplemenu.defaults, options);
        
        function buildsimplemenu() {
            var mmenu = '', i = 0;
            if (opts.fields.length > 0) {
                for (i = 0; i < opts.fields.length; i++) {
                    if (opts.fields[i].ftype === '{') {
                        mmenu = mmenu + '<li><a href="#' + i + '">' + opts.fields[i].name + '</a><ul>';
                    } else if (opts.fields[i].ftype === '}') {
                        mmenu = mmenu + '</ul></li>';
                    } else {mmenu = mmenu + '<li><a href="#' + i + '">' + opts.fields[i].name + '</a></li>'; }
                }
            }
            return '<div id="' + opts.menu + '" class="sqlsimplemenu">' + '<ul class="clickmenu">' + mmenu + '</ul>' + '</div>';
        }
        
        function buildselectboxmenu() {
            var mmenu = '', fieldvals = '', farray = [], ff = [], h = 0, i = 0;
            if (opts.onselectablelist) {
                fieldvals = opts.onselectablelist(opts.menuid);
                farray = fieldvals.split(',');
                for (h = 0; h < farray.length; h++) {
                    ff[h] = {
                        'name': farray[h]
                    };
                }
                opts.fields = ff;
            }
            if (opts.fields.length > 0) {
                mmenu = mmenu + '<li><input type="checkbox" href="#0" id="' + opts.checkalltext + '">' + opts.checkalltext + '</li>';
                for (i = 0; i < opts.fields.length; i++) {
                    mmenu = mmenu + '<li><input type="checkbox" ' + (opts.checkeditems.indexOf(opts.fields[i].name) !== -1 ? ' checked ' : '') + 'href="#' + (i + 1) + '" id="' + opts.fields[i].name + '">' + opts.fields[i].name + '</li>';
                }
            }
            return '<div id="' + opts.menu + '" class="sqlsimplemenu">' + '<ul class="clickmenu">' + mmenu + '</ul>' + '</div>';
        }

        return this.each(function () {
            this.opts = opts;
            var sm = opts.mtype === 'selectbox' ? buildselectboxmenu() : buildsimplemenu();
            $(document.body).after(sm);
            $('div#' + opts.menu).hide();
            $(this).click(function (e) {
                var srcelement = $(this);
                e.stopPropagation();
                $('div.sqlsimplemenu').hide();
                if (!e.pageX) {
                    e.pageX = mouseX;
                    e.pageY = mouseY;
                }
                $('div#' + opts.menu).css({
                    top: e.pageY + 5,
                    left: e.pageX + 5,
                    position: 'absolute'
                }).slideToggle(200);
                $(document).unbind('click').click(function (e) {
                    $('div#' + opts.menu).slideUp(200, function () {
                        if (opts.onselectclose) {opts.onselectclose($(this)); }
                    });
                    $(document).unbind('click');
                    e.stopPropagation();
                    return false;
                });

                $('div#' + opts.menu).find('input[type=checkbox]').unbind('click').click(function (e) {
                    e.stopPropagation();
                    if ($(this).attr('href').substr(1) === 0) {
                        $('div#' + opts.menu).find('input[type=checkbox]').attr('checked', $(this).attr('checked') ? true : false);
                    } else {$(this).attr('checked', $(this).attr('checked') ? true : false); }

                    var items = [], k = 0, items_str = '';
                    $('div#' + opts.menu).find('input[type=checkbox]').each(function () {
                        if ($(this).attr('href').substr(1) !== '0') {
                            items[k] = ($(this).attr('checked') ? $(this).attr('id') : '');
                            if ($(this).attr('checked')) { k++; }
                        }
                    });

                    if (k === 0) { items[0] = '[]'; }
                    items_str = items.join(',');
                    if (items_str.substr(-1, 1) === ',') { items_str = items_str.substr(0, items_str.length - 1); }
                    if (opts.onselect) { opts.oncheck($(this).attr('href').substr(1), $(srcelement), $(this), items_str); }
                });

                $('div#' + opts.menu).find('a').unbind('click').click(function (e) {
                    var selitem = $(this);
                    $('div#' + opts.menu).slideUp(200, function () {});
                    if (opts.onselect) { opts.onselect($(selitem).attr('href').substr(1), $(srcelement), null); }
                    return false;
                });
                return false;
            });
        });
    };
    $.fn.sqlquerybuilder = function (options) {
        $.fn.sqlquerybuilder.defaults = {
            reportid: 0,
            counters: [0, 0, 0, 0],
            sqldiv: null,
            presetlistdiv: null,
            reporthandler: null,
            datadiv: null,
            statusmsgdiv: null,
            whereinput: null,
            sortinput: null,
            groupinput: null,
            columninput: null,
            allinput: null,
            reportnameprompt: 'Report name',
            reportnameinput: 'type your report name here',
            columntitle: 'Result columns ..',
            addnewcolumn: '[Click to a add new column]..',
            showcolumn: true,
            wheretitle: 'Select records where all of the following apply ..',
            addnewwhere: '[Click to a add new condition]..',
            showwhere: true,
            sorttitle: 'Sort columns by..',
            addnewsort: '[Click to a add new sort column]..',
            showsort: true,
            grouptitle: 'Group columns by..',
            addnewgroup: '[Click to a add new group column]..',
            showgroup: true,
            deletetext: 'X',
            animate: true,
            onchange: null,
            onselectablelist: null,
            fields: [],
            joinrules: [],
            extrawhere: '',
            operators: [{
                name: 'equal',
                op: "%f='%s'",
                multipleval: false
            }, {
                name: 'not equal',
                op: "%f!='%s'",
                multipleval: false
            }, {
                name: 'starts with',
                op: "%f like '%s%'",
                multipleval: false
            }, {
                name: 'not starts with',
                op: "not(%f like '%s%')",
                multipleval: false
            }, {
                name: 'contains',
                op: "%f like '%%s%'",
                multipleval: false
            }, {
                name: 'not contains',
                op: "not(%f like '%%s%')",
                multipleval: false
            }, {
                name: 'bigger than',
                op: "%f>'%s'",
                multipleval: false
            }, {
                name: 'bigger or equal',
                op: "%f>='%s'",
                multipleval: false
            }, {
                name: 'smaller than',
                op: "%f<'%s'",
                multipleval: false
            }, {
                name: 'smaller or equal',
                op: "%f<='%s'",
                multipleval: false
            }, {
                name: 'in between',
                op: "%f between '%s1' and '%s2'",
                multipleval: true,
                info: ''
            }, {
                name: 'not in between',
                op: "not(%f between '%s1' and '%s2')",
                multipleval: true,
                info: ''
            }, {
                name: 'is in',
                op: "%f in (%s)",
                multipleval: false,
                selectablelist: true,
                info: ''
            }, {
                name: 'is not in',
                op: "not(%f in (%s))",
                multipleval: false,
                selectablelist: true,
                info: ''
            }, {
                name: 'is null',
                op: " %f is null",
                multipleval: false
            }],
            chain: [{
                name: ' and ',
                op: ' and '
            }, {
                name: ' or ',
                op: ' or '
            }, {
                name: ' and ( ',
                op: ' and ( '
            }, {
                name: ' or ( ',
                op: ' or ( '
            }, {
                name: ' ) and ',
                op: ' ) and '
            }, {
                name: ' ) or ',
                op: ' ) or '
            }, {
                name: ' ) . ',
                op: ' ) '
            }, {
                name: ' . ',
                op: ''
            }],
            astagpre: '"',
            astagsuf: '"'
        };
        var opts = $.extend({}, $.fn.sqlquerybuilder.defaults, options), sqlwidget = $(this), howmany = opts.amount;

        function addnewsqlwhere() {
            var sql_text = opts.wheretitle + "<br>";
            return sql_text;
        }

        function addnewsqlcolumn() {
            var sql_text = opts.columntitle + "<br>";
            return sql_text;
        }

        function addnewsqlgroup() {
            var sql_text = opts.grouptitle + "<br>";
            return sql_text;
        }

        function addnewsqlsort() {
            var sql_text = opts.sorttitle + "<br>";
            return sql_text;
        }

        function onchangeevent(type) {
            var columns = [], ccount = 0, tablehash = [], data = '', colstr = '', sorts = [], scount = 0, sortstr = '', groups = [], gcount = 0, groupstr = [], wheres = [], wcount = 0, prevchain = ' ', prevchainstr = ' ', wherestr = '', tcount = 0, tables = [], tablestr = '', tablename = '', j = 0, k = 0;
            if (opts.datadiv) {
                data = '{' + '"reportid":"' + opts.reportid + '",';
                data = data + '"columndata":[';
                $('span.sqlcolumn').each(function () {
                    var col_slot = $(this).find('a.addnewsqlcolumn').attr('href').substr(1), col_as = $(this).find('span.addnewsqlcolumnvalue').html(), columndata = '{' + '"columnslot":"' + col_slot + '",' + '"columnas":"' + col_as + '"' + '},';
                    data = data + columndata;
                });
                if (data.substr(-1, 1) === ',') { data = data.substr(0, data.length - 1); }
                data = data + '],';
                data = data + '"sortdata":[';
                $('span.sqlsort').each(function () {
                    var col_slot = $(this).find('a.addnewsqlsort').attr('href').substr(1), col_as = $(this).find('span.addnewsqlsortvalue').html(), columndata = '{' + '"columnslot":"' + col_slot + '",' + '"columnas":"' + col_as + '"' + '},';
                    data = data + columndata;
                });
                if (data.substr(-1, 1) === ',') { data = data.substr(0, data.length - 1); }
                data = data + '],';
                data = data + '"groupdata":[';
                $('span.sqlgroup').each(function () {
                    var col_slot = $(this).find('a.addnewsqlgroup').attr('href').substr(1), columndata = '{' + '"columnslot":"' + col_slot + '"' + '},';
                    data = data + columndata;
                });
                if (data.substr(-1, 1) === ',') { data = data.substr(0, data.length - 1); }                
                data = data + '],';
                data = data + '"wheredata":[';
                $('span.sqlwhere').each(function () {
                    var col_slot = $(this).find('a.addnewsqlwhere').attr('href').substr(1), op_slot = $(this).find('a.addnewsqlwhereoperator').attr('href').substr(1), chain_slot = $(this).find('a.addnewsqlwherechain').attr('href').substr(1), col_value = $(this).find('span.addnewsqlwherevalue').html(), columndata = '{' + '"columnslot":"' + col_slot + '",' + '"opslot":"' + op_slot + '",' + '"chainslot":"' + chain_slot + '",' + '"columnvalue":"' + col_value + '",' + '},';
                    data = data + columndata;
                });
                data = data + ']';
                data = data + '}';
                $('.sqldata', $(sqlwidget)).html(data);
            }

            if (opts.sqldiv) {
                $('span.sqlcolumn').each(function () {
                    var tmp = $(this).find('a.addnewsqlcolumn').attr('href');
                    var tleng = tmp.length;
                    var tsubb = tmp.substr(tleng-2, 2);
                    var ttestsubb = tsubb.substr(0, 1);
                    if (ttestsubb === '#'){
                        var col_slot = tsubb.substr(1);    
                    } else { var col_slot = tsubb; }
                    
                    var col_as = $(this).find('span.addnewsqlcolumnvalue').html(), colfuncarray = [], colfunc = [], xx = [];
                    
                    //alert(opts.fields[col_slot]);
                    var fieldstr = opts.fields[col_slot].field;
                    if (col_as.indexOf(':') !== -1) {
                        
                        colfuncarray = col_as.split(':');
                        colfunc = colfuncarray[1];
                        
                        fieldstr = colfunc.replace('%f', fieldstr);
                        col_as = colfuncarray[0];
                    }
                    columns[ccount++] = fieldstr + ' as ' + opts.astagpre + col_as + opts.astagsuf;
                    xx = opts.fields[col_slot].field.split('.');
                    tablehash[xx[0]] = xx[0];
                });
                colstr = columns.join(',');
                if (ccount === 0) {colstr = ' * '; }
                $('.sqlcolumndata', $(sqlwidget)).html(colstr);
                if (opts.columninput) {$(opts.columninput).val(colstr); }
                sorts = [];
                scount = 0;
                $('span.sqlsort').each(function () {
                    var col_slot = $(this).find('a.addnewsqlsort').attr('href').substr(1), col_as = $(this).find('span.addnewsqlsortvalue').html(), xx = [];
                    sorts[scount++] = opts.fields[col_slot].field + '  ' + (col_as === 'Descending' ? 'desc' : '');
                    xx = opts.fields[col_slot].field.split('.');
                    tablehash[xx[0]] = xx[0];
                });
                sortstr = sorts.join(',');
                $('.sqlsortdata', $(sqlwidget)).html(sortstr);
                if (opts.sortinput) { $(opts.sortinput).val(sortstr); }
                groups = [];
                gcount = 0;
                $('span.sqlgroup').each(function () {
                    var col_slot = $(this).find('a.addnewsqlgroup').attr('href').substr(1), xx = [];
                    groups[gcount++] = opts.fields[col_slot].field;
                    xx = opts.fields[col_slot].field.split('.'); //table.field
                    tablehash[xx[0]] = xx[0];
                });
                groupstr = groups.join(',');
                $('.sqlgroupbydata', $(sqlwidget)).html(groupstr);
                if (opts.groupinput) { $(opts.groupinput).val(groupstr); }
                wheres = [];
                wcount = 0;
                prevchain = ' ';
                prevchainstr = ' ';
                $('span.sqlwhere').each(function () {
                    var col_slot = $(this).find('a.addnewsqlwhere').attr('href').substr(1), op_slot = $(this).find('a.addnewsqlwhereoperator').attr('href').substr(1), chain_slot = $(this).find('a.addnewsqlwherechain').attr('href').substr(1), col_value = $(this).find('span.addnewsqlwherevalue').html(), xx = opts.fields[col_slot].field.split('.'), wstr = '', k = 0;
                    tablehash[xx[0]] = xx[0];
                    wstr = prevchain + opts.operators[op_slot].op;
                    wstr = wstr.replace('%f', opts.fields[col_slot].field);
                    if (opts.operators[op_slot].multipleval) {
                        xx = col_value.split('and');
                        wstr = wstr.replace('%s1', xx[0]);
                        wstr = wstr.replace('%s2', xx[1]);
                    } else {
                        if (opts.operators[op_slot].selectablelist) {
                            xx = col_value.split(',');
                            for (k in xx) {
                                if (xx.hasOwnProperty(k)) {
                                    xx[k] = "'" + xx[k] + "'";
                                }
                            }
                            col_value = xx.join(',');
                        }
                        wstr = wstr.replace('%s', col_value);
                    }
                    prevchain = opts.chain[chain_slot].op;
                    prevchainstr = opts.chain[chain_slot].name;
                    wheres[wcount++] = wstr;
                });
                wherestr = wheres.join(' ');
                $('.sqlwheredata', $(sqlwidget)).html(wherestr);
                if (opts.whereinput) { $(opts.whereinput).val(wherestr); }
                if (prevchainstr.indexOf('.') !== -1) { wherestr += prevchain; }
                if (wcount) { wherestr = ' where ' + wherestr + ' ' + opts.extrawhere; } else if (opts.extrawhere) { wherestr = ' where ' + opts.extrawhere; }
                tcount = 0;
                tables = [];
                for (tablename in tablehash) {
                    if (tablehash.hasOwnProperty(tablename)) {
                        tables[tcount++] = tablename;
                    }
                }
                tablestr = tables.join(',');
                if (tcount > 1) {
                    tablestr = tables[0] + ' ';
                    for (j = 0; j < tcount; j++) {
                        for (k = 0; k < opts.joinrules.length; k++) {
                            if (tables[0] === opts.joinrules[k].table1 && tables[j] === opts.joinrules[k].table2) { tablestr += opts.joinrules[k].rulestr + ' '; }
                        }
                    }
                }

                if (opts.sqldiv) { $(opts.sqldiv).html('select ' + colstr + ' from ' + tablestr + wherestr + (gcount ? (' group by ' + groupstr) : '') + (scount ? (' order by ' + sortstr) : '')); }
                $('.sqlalldata', $(sqlwidget)).html('select ' + colstr + ' from ' + tablestr + wherestr + (gcount ? (' group by ' + groupstr) : '') + (scount ? (' order by ' + sortstr) : ''));
                if (opts.allinput) { $(opts.allinput).val('select ' + colstr + ' from ' + tablestr + wherestr + (gcount ? (' group by ' + groupstr) : '') + (scount ? (' order by ' + sortstr) : '')); }
            }
        }

        return this.each(function () {
            this.opts = opts;
            var columnmarkup = addnewsqlcolumn(), wheremarkup = addnewsqlwhere(), sortmarkup = addnewsqlsort(), groupmarkup = addnewsqlgroup(), sqlbuildelement = $(this);
            if (opts.presetlistdiv && opts.reporthandler) {
                $.ajax({
                    type: 'POST',
                    url: opts.reporthandler + '?op=list',
                    data: 'reportid=' + opts.reportid,
                    error: function () {
                        if (opts.statusmsgdiv) { $(opts.statusmsgdiv).html("Can't load preset"); }
                    },
                    success: function (data) {
                        $(opts.presetlistdiv).html(data);
                        $(opts.presetlistdiv).find('ul.treeview li.list').after("<li><a href='#' id='save_" + opts.reportid + "'>Save current sql...</a></li>");
                        $(opts.presetlistdiv).find("#save_" + opts.reportid).click(function () {
                            var name = prompt(opts.reportnameprompt, opts.reportnameinput);
                            if (!name) { return false; }
                            $.ajax({
                                type: 'POST',
                                url: opts.reporthandler + '?op=save&reportid=' + opts.reportid + '&reportname=' + encodeURIComponent(name),
                                data: 'querytosave=' + $('.sqldata', $(sqlbuildelement)).html(),
                                error: function () {
                                    if (opts.statusmsgdiv) { $(opts.statusmsgdiv).html("Can't save the report sql"); }
                                },
                                success: function (data) {
                                    if (opts.statusmsgdiv) { $(opts.statusmsgdiv).html(data); }
                                }
                            });
                            return false;
                        });
                        $(opts.presetlistdiv).sqlsimpletreeview({
                            onselect: function (e) {
                                $.ajax({
                                    type: 'GET',
                                    url: opts.reporthandler + '?op=load&reportname=' + encodeURIComponent(e.html()),
                                    data: 'reportid=' + opts.reportid,
                                    success: function (data) {
                                        sqlbuildelement.loadSQB(data);
                                    }
                                });
                            }
                        });
                    }
                });
            }
            $(this).html('<p class="sqldata"></p>' + '<p class="sqlwheredata"></p>' + '<p class="sqlsortdata"></p>' + '<p class="sqlcolumndata"></p>' + '<p class="sqlgroupbydata"></p>' + '<p class="sqlalldata"></p>' + '<p class="sqlbuildercolumn">' + columnmarkup + '<a class="addnewsqlcolumn" id="9999" href="#">' + opts.addnewcolumn + '</a>' + '</p>' + '<p class="sqlbuilderwhere">' + wheremarkup + '<a class="addnewsqlwhere" id="9999" href="#">' + opts.addnewwhere + '</a>' + '</p>' + '<p class="sqlbuildergroup">' + groupmarkup + '<a class="addnewsqlgroup" id="9999" href="#">' + opts.addnewgroup + '</a>' + '</p>' + '<p class="sqlbuildersort">' + sortmarkup + '<a class="addnewsqlsort" id="9999" href="#">' + opts.addnewsort + '</a>' + '</p>');
            $('.sqldata, .sqlalldata, .sqlcolumndata, .sqlwheredata, .sqlsortdata, .sqlgroupbydata').hide();
            if (!opts.showcolumn) { $(".sqlbuildercolumn").hide(); }
            if (!opts.showsort) { $(".sqlbuildersort").hide(); }
            if (!opts.showgroup) { $(".sqlbuildergroup").hide(); }
            if (!opts.showwhere) { $(".sqlbuilderwhere").hide(); }

            $('.addnewsqlcolumn, .addnewsqlsort, .addnewsqlgroup').sqlsimplemenu({
                menu: 'sqlmenulist',
                fields: opts.fields,
                onselect: function (action, el, defval) {
                    var menutype = 'column', countertype = 0;
                    if ($(el).hasClass('addnewsqlcolumn')) {
                        menutype = 'column';
                        countertype = 0;
                    } else if ($(el).hasClass('addnewsqlsort')) {
                        menutype = 'sort';
                        countertype = 1;
                    } else if ($(el).hasClass('addnewsqlgroup')) {
                        menutype = 'group';
                        countertype = 2;
                    }
                    var sqlline = '<span class="sql' + menutype + '" id=' + (opts.counters[countertype]) + '>' + '<a class="addnewsql' + menutype + 'delete" id=' + (opts.counters[countertype]) + ' href="#' + action + '">' + opts.deletetext + '</a>&nbsp;' + '<a class="addnewsql' + menutype + '" id=' + (opts.counters[countertype]) + ' href="#' + action + '">' + opts.fields[action].name + '</a>' + (countertype === 2 ? '' : '&nbsp;as &nbsp;') + '<span class="addnewsql' + menutype + 'value" id=' + (opts.counters[countertype]) + ' href="#0">' + ((countertype === 0 || countertype === 2) ? (countertype === 0 ? (defval ? defval.columnas : opts.fields[action].name) : '') : (defval ? defval.columnas : 'Ascending')) + '</span>&nbsp;' + '</span>';
                    var item = $(sqlline).hide();
                    $('[class=addnewsql' + menutype + '][id=9999]').before(item);
                    if (opts.animate) {
                        $(item).animate({
                            opacity: "show",
                            height: "show"
                        }, 150, "swing", function () {
                            $(item).animate({
                                height: "+=3px"
                            }, 75, "swing", function () {
                                $(item).animate({
                                    height: "-=3px"
                                }, 50, "swing");
                                onchangeevent('new');
                            });
                        });
                    } else {
                        $(item).show();
                        onchangeevent('new');
                    }
                    if (countertype === 1) {
                        $("span[class=addnewsql" + menutype + "value][id='" + (opts.counters[countertype]) + "']").sqlsimplemenu({
                            menu: 'sortmenu',
                            fields: [{
                                name: 'Ascending'
                            }, {
                                name: 'Descending'
                            }],
                            onselect: function (action, el) {
                                $(el).text(action === 0 ? 'Ascending' : 'Descending');
                                onchangeevent('change');
                            }
                        });
                    } else {
                        $("span[class=addnewsql" + menutype + "value][id='" + (opts.counters[countertype]) + "']").click(function (e) {
                            e.stopPropagation();
                            var element = $(this), fieldid = $('a[class=addnewsql' + menutype + '][id=' + element.attr('id') + ']').attr('href').substr(1), slotid = element.attr('id'), oldhtml = '';
                            if (element.hasClass("editing") || element.hasClass("disabled")) {
                                return;
                            }
                            element.addClass("editing");
                            oldhtml = $(this).html();
                            $(this).html('<input type="text" class="editfield" id=99><span class="sqlsyntaxhelp"></span>');
                            $('.editfield').val(oldhtml.replace(/^\s+|\s+$/g, ""));
                            $('.editfield').blur(function () {
                                element.html($(this).val().replace(/^\s+|\s+$/g, ""));
                                element.removeClass("editing");
                                element.removeAttr('disabled');
                                $('.sqlsyntaxhelp').remove();
                                onchangeevent('change');
                            });

                            $('.editfield', element).keyup(function (event) {
                                if (event.which === 13) {
                                    element.html($(this).val());
                                    element.removeClass("editing");
                                    element.removeAttr("disabled");
                                    $('.sqlsyntaxhelp').remove();
                                    onchangeevent('change');
                                }
                                return true;
                            });
                            element.removeAttr('disabled');
                            $('input[class=editfield][id=99]').focus().select();
                        });
                    }
                    $("[class=addnewsql" + menutype + "delete][id='" + (opts.counters[countertype]) + "']").click(function () {
                        var item = $('span[class=sql' + menutype + '][id=' + $(this).attr('id') + ']');
                        if (opts.animate) { $(item).animate({
                            opacity: "hide",
                            height: "hide"
                        }, 150, "swing", function () {
                            $(this).hide().remove();
                            onchangeevent('change');
                        });
                            } else {
                            $(item).hide().remove();
                            onchangeevent('change');
                        }
                    });
                    $("[class=addnewsql" + menutype + "][id='" + (opts.counters[countertype]) + "']").sqlsimplemenu({
                        menu: 'sqlmenulist',
                        fields: opts.fields,
                        onselect: function (action, el) {
                            $("[class=addnewsql" + menutype + "][id=" + $(el).attr('id') + "]").html(opts.fields[action].name).attr('href', "#" + action);
                            onchangeevent('change');
                        }
                    });
                    opts.counters[countertype]++;
                }
            });
            $("[class=addnewsqlwhere][id=9999]").sqlsimplemenu({
                menu: 'sqlmenulist',
                fields: opts.fields,
                onselect: function (action, el, defval) {
                    var sqlline = '<span class="sqlwhere" id=' + opts.counters[3] + '>' + '<a class="addnewsqlwheredelete" id=' + opts.counters[3] + ' href="#' + action + '">' + opts.deletetext + '</a>&nbsp;' + '<a class="addnewsqlwhere" id=' + opts.counters[3] + ' href="#' + action + '">' + opts.fields[action].name + '</a>&nbsp;' + '<a class="addnewsqlwhereoperator" id=' + opts.counters[3] + ' href="#' + (defval ? defval.opslot : '0') + '">' + opts.operators[(defval ? defval.opslot : 0)].name + '</a>&nbsp;' + '<span class="addnewsqlwherevalue" id=' + opts.counters[3] + ' href="#0">' + (defval ? defval.columnvalue : opts.fields[action].defaultval) + '</span>&nbsp;' + '<a class="addnewsqlwherechain" id=' + opts.counters[3] + ' href="#' + (defval ? defval.chainslot : '0') + '">' + opts.chain[(defval ? defval.chainslot : 0)].name + '</a>&nbsp;' + '</span>', item = $(sqlline).hide();
                    $('[class=addnewsqlwhere][id=9999]').before(item);
                    if (opts.animate) { $(item).animate({
                        opacity: "show",
                        height: "show"
                    }, 150, "swing", function () {
                        $(item).animate({
                            height: "+=3px"
                        }, 75, "swing", function () {
                            $(item).animate({
                                height: "-=3px"
                            }, 50, "swing", function () {
                                onchangeevent('new');
                            });
                        });
                    });
                        } else {
                        $(item).show();
                        onchangeevent('new');
                    }
                    $("span[class=addnewsqlwherevalue][id='" + opts.counters[3] + "']").click(function (e) {
                        e.stopPropagation();
                        var element = $(this), operatorid = $('a[class=addnewsqlwhereoperator][id=' + element.attr('id') + ']').attr('href').substr(1), fieldid = $('a[class=addnewsqlwhere][id=' + element.attr('id') + ']').attr('href').substr(1), chainid = $('a[class=addnewsqlwherechain][id=' + element.attr('id') + ']').attr('href').substr(1), slotid = element.attr('id'), oldhtml = '', vals = [], editfield = '', fieldvals = '', farray = [], ff = [], h = 0;
                        if (element.hasClass("editing") || element.hasClass("disabled")) {
                            return;
                        }
                        element.addClass("editing");
                        oldhtml = $(this).html();
                        if (opts.operators[operatorid].multipleval) {
                            $(this).html('<input type="text" class="editfield" id=1> and <input type="text" class="editfield" id=2> <span class="sqlsyntaxhelp"></span>');
                            vals = oldhtml.split('and');
                            $('input[class=editfield][id=1]').val(vals[0].replace(/^\s+|\s+$/g, ""));
                            $('input[class=editfield][id=2]').val(vals[1].replace(/^\s+|\s+$/g, ""));
                        } else {
                            $(this).html('<input type="text" class="editfield" id=99><span class="sqlsyntaxhelp"></span>');
                            $('.editfield').val(oldhtml.replace(/^\s+|\s+$/g, ""));
                            if (opts.operators[operatorid].selectablelist) {
                                editfield = $(this);
                                fieldvals = '';
                                if (opts.onselectablelist) { fieldvals = opts.onselectablelist(slotid); }
                                farray = fieldvals.split(',');
                                ff = [];
                                for (h = 0; h < farray.length; h++) {
                                    ff[h] = {
                                        'name': farray[h]
                                    };
                                }
                                $('input[id=99]').sqlsimplemenu({
                                    menu: 'selectmenu' + slotid,
                                    menuid: slotid,
                                    mtype: 'selectbox',
                                    onselectablelist: function (slotid) {
                                        return opts.onselectablelist(slotid, fieldid, operatorid, chainid);
                                    },
                                    onselectclose: function (el) {
                                        element.removeClass("editing");
                                        element.attr("disabled", "disabled");
                                        $('.sqlsyntaxhelp').remove();
                                        $('#selectmenu' + slotid).remove();
                                        onchangeevent('changed');
                                    },
                                    checkeditems: oldhtml,
                                    fields: ff,
                                    onselect: function (action, el) {
                                        $(editfield).htlm();
                                    },
                                    oncheck: function (action, el, checkbox, checkitems) {
                                        $(editfield).html(checkitems);
                                        onchangeevent('change');
                                    }
                                });
                                $(this).trigger('click');
                            }
                        }
                        $('.sqlsyntaxhelp').html(opts.operators[operatorid].info);
                        $('.editfield').blur(function () {
                            switch ($(this).attr('id')) {
                            case '99':
                                element.html($(this).val().replace(/^\s+|\s+$/g, ""));
                                break;
                            case '1':
                                return;
                            case '2':
                                element.html($('input[class=editfield][id=1]').val().replace(/^\s+|\s+$/g, "") + ' and ' + $('input[class=editfield][id=2]').val().replace(/^\s+|\s+$/g, ""));
                                break;
                            }
                            element.removeClass("editing");
                            element.removeAttr('disabled');
                            $('.sqlsyntaxhelp').remove();
                            onchangeevent('change');
                        });

                        $('.editfield', element).keyup(function (event) {
                            if (event.which === 13) {
                                switch ($(this).attr('id')) {
                                case '99':
                                    element.html($(this).val());
                                    break;
                                case '1':
                                    $('input[class=editfield][id=2]').focus().select();
                                    return;
                                case '2':
                                    element.html($('input[class=editfield][id=1]').val() + ' and ' + $('input[class=editfield][id=2]').val());
                                    break;
                                }
                                element.removeClass("editing");
                                element.removeAttr("disabled");
                                $('.sqlsyntaxhelp').remove();
                                onchangeevent('change');
                            }
                            return true;
                        });
                        element.removeAttr('disabled');
                        $('input[class=editfield][id=' + (opts.operators[operatorid].multipleval ? '1' : '99') + ']').focus().select();
                    });
                    $("[class=addnewsqlwheredelete][id='" + opts.counters[3] + "']").click(function () {
                        var item = $('span[class=sqlwhere][id=' + $(this).attr('id') + ']');
                        if (opts.animate) { $(item).animate({
                            opacity: "hide",
                            height: "hide"
                        }, 150, "swing", function () {
                            $(this).hide().remove();
                            onchangeevent('change');
                        });
                            } else {
                            $(item).hide().remove();
                            onchangeevent('change');
                        }
                    });
                    $("[class=addnewsqlwhere][id='" + opts.counters[3] + "']").sqlsimplemenu({
                        menu: 'sqlmenulist',
                        fields: opts.fields,
                        onselect: function (action, el) {
                            $("[class=addnewsqlwhere][id=" + $(el).attr('id') + "]").html(opts.fields[action].name).attr('href', "#" + action);
                            onchangeevent('change');
                        }
                    });

                    $("[class=addnewsqlwhereoperator][id='" + opts.counters[3] + "']").sqlsimplemenu({
                        menu: 'operatorlist',
                        fields: opts.operators,
                        onselect: function (action, el) {
                            var val = '', vals = '';
                            $("[class=addnewsqlwhereoperator][id=" + $(el).attr('id') + "]").html(opts.operators[action].name).attr('href', "#" + action);
                            if (opts.operators[action].multipleval) {
                                val = $("[class=addnewsqlwherevalue][id=" + $(el).attr('id') + "]").html();
                                $("[class=addnewsqlwherevalue][id=" + $(el).attr('id') + "]").html(val + ' and ' + val);
                            } else {
                                val = $("[class=addnewsqlwherevalue][id=" + $(el).attr('id') + "]").html();
                                if (val.indexOf('and') !== -1) {
                                    vals = $("[class=addnewsqlwherevalue][id=" + $(el).attr('id') + "]").html().split('and');
                                    $("[class=addnewsqlwherevalue][id=" + $(el).attr('id') + "]").html(vals[0]);
                                }
                            }
                            onchangeevent('change');
                        }
                    });

                    $("[class=addnewsqlwherechain][id='" + opts.counters[3] + "']").sqlsimplemenu({
                        menu: 'chainlist',
                        fields: opts.chain,
                        onselect: function (action, el) {
                            $("[class=addnewsqlwherechain][id=" + $(el).attr('id') + "]").html(opts.chain[action].name).attr('href', "#" + action);
                            onchangeevent('change');
                        }
                    });
                    opts.counters[3]++;
                }
            });
        });
    };
}(jQuery));

#2 22-02-2012 21:07
  • Martin P
  • Groep: Moderators
  • Posts: 3645
  • Actief sinds: 19-04-2007

Bekijk Post Op 22-02-2012 21:58 schreef Rolf Kransse:

Mijn code geeft geen foutmeldingen, maar als ik de compatibiliteitfuncties aanzet in IE8, of de site in IE7 laat draaien, dan werkt het klikken op de links niet.
Het is een veelvoorkomend probleem dat scripts niet werken in de compatibiliteitsmodus van IE. Heb je het getest in een echte IE7 (dus geen simulator of settings van nieuwere IE-versies)? Je kunt met javascript controleren of de compatibiliteitsmodus aanstaat en een waarschuwing geven dat zaken mogelijk niet correct functioneren.
Handleidingen zijn er niet voor niets, gebruik ze dus :)
HTML5 ~ CSS ~ PHP ~ MySQL ~ SQL-injectie bestaat meer dan 13 jaar

#3 23-02-2012 07:18
Martin,

Ik heb het ook getest met een native IE7, maar helaas heb ik die nu even niet tot mijn beschikking, maar die leverde eerder ook problemen op. Echter worden er geen foutmeldingen meer getoond in de compatibiliteitsmodus, dus het script zou op zich goed moeten zijn. Foutmelding geven dat het niet functioneert kan uiteraard, maar de standaard pc's in het bedrijf waar dit zou moeten gaan draaien werken allemaal nog met ie7 en xp, vandaar dat ik er eigenlijk niet omheen kan.


Inloggen wachtwoord vergeten? Aanmelden