jQuery UI Widgets Forums Grid Bugg with sorting?

This topic contains 4 replies, has 2 voices, and was last updated by  Programmerswe 9 years, 1 month ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
  • Bugg with sorting? #75756

    Programmerswe
    Participant

    Hi!
    Ive got a grid on which I’m using sorting. On row expand, I’m getting the some values stored in the grid (username for example) and put it in an alert to see that the correct values is given. It works perfect! However, when i use the exact same code on an other event, cellendedit for example, the username isn’t correct. It works when i remove the filtering.
    Now, when i search for a user and do a row expand, it still works. However, on cellendedit, it gives the value of null.

    Any solutions for this?

    Bugg with sorting? #75772

    ivailo
    Participant

    Hi Programmerswe,

    Please send a fiddle/jseditor link with your code for analyze.

    Best Regards,
    Ivailo Ivanov

    jQWidgets Team
    http://www.jqwidgets.com

    Bugg with sorting? #75773

    Programmerswe
    Participant

    Ive got some sensitive code that i really cant shear for all to see.
    however, i can give this to you, it should be enough.

    
    $('#jqxGrid').on('rowexpand', function (event) {
    			var args = event.args;
    			var details = args.details;
    			selectedRowIndex = args.rowindex;
    			var boundIndex = $('#jqxGrid').jqxGrid('getrowboundindex', selectedRowIndex);
    			var val = $('#jqxGrid').jqxGrid('getcellvalue', boundIndex, "Id");
    			var vall = $('#jqxGrid').jqxGrid('getcellvalue', boundIndex, "UserName");
    			var rows = $('#jqxGrid').jqxGrid('getrows');
    			var id = 'yourIframe_'+val;
    			var usertest = document.getElementById("loggedInUser").innerHTML;
    		   window.setTimeout( function(){
    			   
                       alert ("Username: "+vall+" id: "+val);
    		   }, 10); 
    		});
    

    This works no matter if the grid got a filter and i search on it and select an user wile it filtered for exemple: “Pizzas”. Its awesome.

    
    $("#jqxGrid").on('cellendedit', function (event) 
    		{
    			// event arguments.
    			var args = event.args;
    			// column data field.
    			var dataField = event.args.datafield;
    			// row's bound index.
    			var rowBoundIndex = event.args.rowindex;
    			// cell value
    			var value = args.value;
    			// cell old value.
    			var oldvalue = args.oldvalue;
    			// row's data.
    			var rowData = args.row;
    			
    			var args = event.args;
    			var details = args.details;
    			selectedRowIndex = args.rowindex;
    			var boundIndex = $('#jqxGrid').jqxGrid('getrowboundindex', selectedRowIndex);
    			var val = $('#jqxGrid').jqxGrid('getcellvalue', boundIndex, "Id");
    			var vall = $('#jqxGrid').jqxGrid('getcellvalue', boundIndex, "UserName");
    			
    			alert ("Username: "+vall+" id: "+val);
       
    			}
    			
    		});
    

    This code however, dosn’t. It dosn’t take to account that the grid is filtered. And therefore, when i do a cell edit in the start, it might show the username and id for the user 4 rows down or so. And if i filter again for “pizzas”, it only gives me null as values.

    So, basically on the rowexpand, it works perfectly. On cellendedit or any other event, it dosn’t work for me!

    I’m sorry for my lack of english, its not my native language. And cheers for all the help, you guys are awesome.

    Bugg with sorting? #75792

    Programmerswe
    Participant

    Is it enough to see the problem?

    Bugg with sorting? #75801

    Programmerswe
    Participant

    Never mind. Ive solved it!

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.