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
Highlighting of selected row and drag and drop issue.
27/05/2010
22:56
Avatar
DroidDr
Member
Members
Forum Posts: 7
Member Since:
27/05/2010
sp_UserOfflineSmall Offline

Hi all,

I am building a grid that is not multi-select, with row drag and drop enabled, using the .sortableRows() function.

The problem is that when I have a selected row, and I drag another row that is not the selected one, when I finish dragging it to its detination and select it, the previous selected one remains highlighted, and the new selected one is also highlighted.

When I use 'jQuery("#grid_sched1").getGridParam("selrow")' it returns the newest selected (and highlighted) row, as it should.

This problem happens only when I drag the row 'through' the highlighted one. It looks like maybe it forgets or gets confused as to which row is highlighed and does not un-highlight it.

For testing I am using jquery 1.4.2, jquery ui 1.81, jqgrid 3.6.5.

I had the same problem using jqgrid 3.4.1 using tablednd. (this is why I did a test on the latest versions).

Does anyone have an idea on how I can fix this?

Thanks and best wishes to all!

----------

here is the code to create the grid.

    jQuery("#grid_sched1").jqGrid({
        //url: "",
        //datatype: 'json',      // how the data is given to us
        datatype: 'local',
        width: 750,
        height: 300,
        colNames:['#','STD#', 'SUP.C.', 'GRADE','MIX','TONS REQ','TONS PROD','COMPL','DATE','INSTR'],     // names of columns
        colModel :[
        {name:'SEQ', index:'SEQ', width:30, sortable: true},         
        {name:'STDNUM', index:'STDNUM', width:40, sortable: false},         
        {name:'SUPP_CODE', index:'SUPP_CODE', width:40, sortable: false},
        {name:'GRADE', index:'GRADE', width:70, sortable: false},
        {name:'MIX', index:'MIX', width:40, sortable: false},
        {name:'TONS_REQ', index:'TONS_REQ', width:60, sortable: false},
        {name:'TONS_PROD', index:'TONS_PROD', width:60, sortable: false},
        {name:'COMPL', index:'COMPL', width:40, sortable: true},
        {name:'DATE_REQ', index:'CANC.', width:70, sortable: true},         
        {name:'INSTR', index:'INSTR', width:200, align:'right', editable: true, editrules:{ required: false }, edittype: 'textarea', sortable: false }
        ],
        cellEdit: true,
        cellsubmit: 'clientArray',
        cellurl: '',  
        //pager: jQuery('#pager'),        //pager bar
        rowNum:30,                      // number of records
        rowList:[12,24],             // change # or rows visible through grid
        sortname: 'SEQ',                 // init sorting
        sortorder: "asc",              // init sort order
        viewrecords: true,              // show total # of records in pager.
        caption: 'PROD SCHEDULE',
        hidegrid: true,
        hiddengrid: false,
        imgpath: 'jquery/jqgrid/themes/basic/images',     // path to imgs.
        //multiselect: true,
        loadComplete: function(){
            //alert("init reason grid load");
            //addDelButtons(-1);
            //update_reason_list();
            //alert("test");
        },

        gridComplete: function(){
            //alert('gridcomplete');
            //jQuery("#grid_sched1").tableDnDUpdate();
        },
        beforeEditCell: function(rowid, cellname, value, iRow, iCol){
            //beforeEditCell: function(rowid){rowid
            //creasonEditingCell = 1; creasonEditingRowid = rowid; creasonEditingICol = iCol; creasonEditingIRow = iRow;
            //alert("before edit");
        },
        afterEditCell: function(rowid, cellname, value, iRow, iCol){
            //beforeEditCell: function(rowid){rowid
            //creasonEditingCell = 1; creasonEditingRowid = rowid; creasonEditingICol = iCol; creasonEditingIRow = iRow;
            //alert("after edit");
        },        
        afterSaveCell: function(rowid, cellname, value, iRow, iCol){
            //creasonEditingCell = 0; creasonEditingRowid = 0; creasonEditingICol = 0; creasonEditingIRow = 0;
            //alert("after save");
        },
        onCellSelect: function(rowid){
            //add_note('selected: ' + jQuery("#list").getGridParam("selrow")  );
            //alert('selected: ' + (jQuery("#grid_sched1").getRowData(rowid)).SEQ );
        }
    });
    jQuery("#grid_sched1").sortableRows();

30/05/2010
14:01
Avatar
tony
Sofia, Bulgaria
Moderator
Members

Moderators
Forum Posts: 7721
Member Since:
30/10/2007
sp_UserOfflineSmall Offline

Hello,

I think that the problem here is that you have a rows with equall id's. This will cause this behaviour.

Regards

Tony

For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.

22/06/2010
01:20
Avatar
DroidDr
Member
Members
Forum Posts: 7
Member Since:
27/05/2010
sp_UserOfflineSmall Offline

I was pretty sure my row ids are unique. When I load data with my custom ajax request, the first id is 1 then 2, 3, 4, etc.

For now I solved the issue by doing this

- when drag starts, I remove all classes that do the highlighting of the row

- I deselect the selected row if any.

- I select the dragged row when dropped.

This works for now and fixes my issue.

Thanks again for the great work and help Tony.!

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

Currently Online:
41 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