Forum
08:56
14/09/2009
Hi Tony,
I am from Argentina sory for my english ๐
I use jqGrid 3.5 and jQuery 1.3.2
The setSelection function does not work.
The problem is if you use "setSelection" function the next click on the row fails because "tr#" + X doesnt exists
Steps:
1) Load any jqgrid
2) jQuery("#Table1").setSelection(1);
3) I click a row
4) I have an error in the "setSelection : function" in "grid.base.js"
Line:
$("tr#"+$t.p.selrow.replace(".", "\\\\."),$t.grid.bDiv).removeClass("ui-state-highlight").attr("aria-selected","false");
22:12
Moderators
30/10/2007
Hello
Correct first this error and try
colModel:[
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.
06:32
14/09/2009
Tony thank's for your answer but the same problem happens. ๐
The grid works perfect only I have a problems when use the method "setSelection" in any grid (JSON, XML, LOCAL with array) always an exepetion happens when I click in the row after use "setSelection", in all navigators Explorer, chrome, firefox.
To reproduce this error you can follow this steps:
1) Use setSelection method in any grid
2) After click in any row in the grid
3) An exception happens ๐
I love this grid ๐ but i need to select the first row in the grid when my application started..
Thank's a lot.
Marcos.
09:02
30/07/2009
setSelection takes a rowID, not a row index. If the ID you pass in is not the ID of an existing row, you will get this error next time you click on a row, as you describe.
It looks like it would be a good idea for the grid to check that the ID is valid - but you still need to fix your code if you want setSelection to do anything...
Mark
10:32
14/09/2009
I am using the correct RowID (I think so)
For example this code does not work, I will get that error next time you click on a row.
Please, help me. What is my mistake? in this JSON ROW {id:"1",FirstName:"Mark",LastName:"Wise"} is this id:"1" the rowID ??
The row is selected correctly, the problem is when I click on another row in te grid.
Thank you
<script type="text/javascript">
$(document).ready(function(){
CreateGrid();
});
function CreateGrid()
{
jQuery("#Table1").jqGrid({
datatype: "local",
colNames:['FirstName','LastName'],
colModel:[
{name:'FirstName',index:'FirstName', width:130},
{name:'LastName',index:'LastName', width:130}
],
pager: jQuery('#Table1Div1'),
rowNum:2,
rowList:[10,20,30],
caption: "Data",
sortname: 'FirstName',
viewrecords: true
});
var mydata = [
{id:"1",FirstName:"Mark",LastName:"Wise"},
{id:"2",FirstName:"Jhon",LastName:"Harris"}
];
for(var i=0;i<=mydata.length;i++)
jQuery("#Table1").addRowData(i+1,mydata[i]);
jQuery("#Table1").setSelection(2);
}
</script>
11:46
30/07/2009
I see. Sorry, now I see the problem ๐
First, note that the "id" in your data is ignored. The first parameter to addRowData determines the id.
But thats not the problem, because they are the same thing (i+1 == mydata[i].id).
The problem is that rowid's are strings. addRowData correctly converts an integer to a string before using it as an id, but setSelection does not.
I think it will work if you use
or
Mark
11:46
30/07/2009
I see. Sorry, now I see the problem ๐
First, note that the "id" in your data is ignored. The first parameter to addRowData determines the id.
But thats not the problem, because they are the same thing (i+1 == mydata[i].id).
The problem is that rowid's are strings. addRowData correctly converts an integer to a string before using it as an id, but setSelection does not.
I think it will work if you use
or
Mark
12:49
Moderators
30/10/2007
Thanks marcosvitali,
Thanks Mark,
The correction is in GitHub.
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.
Most Users Ever Online: 715
Currently Online:
81 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.comModerators: tony: 7721, Rumen[Trirand]: 81
Administrators: admin: 66