Forum

November 2nd, 2014
A A A
Avatar

Lost password?
Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

The forums are currently locked and only available for read only access
sp_Feed Topic RSS sp_TopicIcon
setSelection bug?
13/10/2009
14:58
Avatar
c.mcpherson
Nashville, TN
New Member
Members
Forum Posts: 2
Member Since:
13/10/2009
sp_UserOfflineSmall Offline

We're seeing a problem where normal row selection with the mouse causes an exception after programmatically setting the selection using setSelection. The following code illustrates the issue.

Are we missing something?

<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DT.....o;&gt;
<html xmlns=”http://www.w3.org/1999/xhtml&rdquo; >
<head>
    <title></title>
    <!–<script type=”text/javascript” src=”depend/json2-min.js”></script>–>
    <script type=”text/javascript” src=”depend/jquery-1.3.2.min.js”></script>
    <script type=”text/javascript” src=”depend/jQueryUI/jquery-ui-1.7.2.custom.min.js”></script>
    <link rel=”Stylesheet” type=”text/css” href=”depend/jQueryUI/smoothness/jquery-ui-1.7.2.custom.css” />
   
    <script type=”text/javascript” src=”depend/jqGrid/grid.locale-en.js”></script>
    <script type=”text/javascript” src=”depend/jqGrid/jquery.jqGrid.min.js”></script>
    <link rel=”Stylesheet” type=”text/css” href=”depend/jqGrid/ui.jqgrid.css” />
    <script type=”text/javascript” >
        $(function() {
            $(”#testGrid”).jqGrid({
                datatype: 'local',
                height: 225,
                width: 915,
                multiselect: false,
                gridview: true,
                scrollRows: true,
                colNames: [
            'Index',
            'Col1',
            'Col2',
            'Col3',
            'Col4',
            'Col5',
            'Col6',
            'Col7',
            'Col8',
            'Col9',
            'Col10'
        ],
                colModel: [
            { name: 'Index', index: 'Index', width: 100, sorttype: 'int' },
            { name: 'Col1', index: 'Col1', width: 100, sorttype: 'string' },
            { name: 'Col2', index: 'Col2', width: 100, sorttype: 'string' },
            { name: 'Col3', index: 'Col3', width: 100, sorttype: 'string' },
            { name: 'Col4', index: 'Col4', width: 100, sorttype: 'string' },
            { name: 'Col5', index: 'Col5', width: 100, sorttype: 'string' },
            { name: 'Col6', index: 'Col6', width: 100, sorttype: 'string' },
            { name: 'Col7', index: 'Col7', width: 100, sorttype: 'string' },
            { name: 'Col8', index: 'Col8', width: 100, sorttype: 'string' },
            { name: 'Col9', index: 'Col9', width: 100, sorttype: 'string' },
            { name: 'Col10', index: 'Col10', width: 100, sorttype: 'string' },
        ]

            });

            for (var i = 1; i < 51; i++) {
                var item = { Index: i,
                    Col1: “Column 1″,
                    Col2: “Column 2″,
                    Col3: “Column 3″,
                    Col4: “Column 4″,
                    Col5: “Column 5″,
                    Col6: “Column 6″,
                    Col7: “Column 7″,
                    Col8: “Column 8″,
                    Col9: “Column 9″,
                    Col10: “Column 10″
                };

                $(”#testGrid”).addRowData(item.Index, item);
            }
           
            $(”#testGrid”).setSelection(5, true);
            //Now selecting a row with the mouse causes an exception -> $t.p.selrow.replace is not a function
            //Comment out the above line and row selection works perfectly
            //We observed this behavior in both IE7 and FireFox
           
        }
        );
    </script>
</head>
<body>
<table id=”testGrid”></table>
</body>
</html>

Thanks!

13/10/2009
18:08
Avatar
markw65
Member
Members
Forum Posts: 179
Member Since:
30/07/2009
sp_UserOfflineSmall Offline

You're setting the id as an integer, rather than a string (you want "5" rather than 5).

This was fixed a few weeks ago - although Im not sure its in the 3.5.3 release.

Mark

14/10/2009
10:57
Avatar
c.mcpherson
Nashville, TN
New Member
Members
Forum Posts: 2
Member Since:
13/10/2009
sp_UserOfflineSmall Offline

That was the trick. Thanks, and sorry if I missed previous posts on this.

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

Currently Online:
55 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

OlegK: 1255

markw65: 179

kobruleht: 144

phicarre: 132

YamilBracho: 124

Renso: 118

Member Stats:

Guest Posters: 447

Members: 11373

Moderators: 2

Admins: 1

Forum Stats:

Groups: 1

Forums: 8

Topics: 10592

Posts: 31289

Newest Members:

, razia, Prankie, psky, praveen neelam, greg.valainis@pa-tech.com

Moderators: tony: 7721, Rumen[Trirand]: 81

Administrators: admin: 66

Comments are closed.
Privacy Policy   Terms and Conditions   Contact Information