Solved

jQuery Flexigrid

Posted on 2008-06-20
8
809 Views
Last Modified: 2010-04-21
Hello Experts,
I am trying to select all the rows available in the Flexigrid and return their IDs to process.
I am using the attached function to call it from the Save button on the page.
<a href="javascript:savetList();" class="button">Save</a>
It is showing the IDs currectly in the alert but the rows are not getting selected, I mean this line is not getting executed
$('.bDiv tbody tr',grid).addClass('trSelected');
can someone please let me know why?
thanks for your help
regards
sam
function savetList(){
   test("save","#listDisplay")
 } 
 
function test(com,grid)
{
if(com=='Save'){
$('.bDiv tbody tr',grid).addClass('trSelected'); 
if($('.trSelected',grid).length == 0){ 
	alert('There is no item to Export.');
}else{
						var items = $('.trSelected',grid);
						var sIds = "";
						for(i=0;i<items.length;i++){									
								sIds +=  "," + items[i].id.substr(3);
						}
								      
						alert(sIds.substr(1));
}}}

Open in new window

0
Comment
Question by:newbie27
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 2
8 Comments
 
LVL 82

Expert Comment

by:hielo
ID: 21831931
>> $('.bDiv tbody tr',grid).addClass('trSelected');
are you saying that your table has class="bDiv"?

If anything, instead of .bDiv try #xxx where xxx is the id of your table
0
 
LVL 8

Author Comment

by:newbie27
ID: 21832026
Hello Hielo,
I have tried the following as you have suggested but it is not selecting the rows.
Please can you help
thanks
 
 if (com=='Export'){
					$('#listDisplay tbody tr',grid).addClass('trSelected'); 
					if($('.trSelected',grid).length == 0){ 
						alert('There is no item to Export.');
					}else{
						var items = $('.trSelected',grid);
						var sIds = "";
						for(i=0;i<items.length;i++){									
								sIds +=  "," + items[i].id.substr(3);
						}
								      
						alert(sIds.substr(1));
						$("#ISBNLists").val(sIds.substr(1));
						$("#frmExport").submit();
					}	

Open in new window

0
 
LVL 8

Author Comment

by:newbie27
ID: 21832028
Hello Hielo,
I have tried the following as you have suggested but it is not selecting the rows.
Please can you help
thanks
 
 if (com=='Export'){
					$('#listDisplay tbody tr',grid).addClass('trSelected'); 
					if($('.trSelected',grid).length == 0){ 
						alert('There is no item to Export.');
					}else{
						var items = $('.trSelected',grid);
						var sIds = "";
						for(i=0;i<items.length;i++){									
								sIds +=  "," + items[i].id.substr(3);
						}
								      
						alert(sIds.substr(1));
						$("#ISBNLists").val(sIds.substr(1));
						$("#frmExport").submit();
					}	

Open in new window

0
How our DevOps Teams Maximize Uptime

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us. Read the use case whitepaper.

 
LVL 8

Author Comment

by:newbie27
ID: 21832152
Heilo,

I thought this should do it but it did not work.

$('.bDiv #listDisplay tbody tr',grid).addClass('trSelected');

I believe I am still not referring the row ID correctly.

Please can you advice.

Thanks for your help HIELO.


<div class="bDiv" style="height: 350px;">
<table id="listDisplay" cellspacing="0" cellpadding="0" border="0" style="">
<tbody>
<tr id="rowe2007092018174409"><td align="left"><div style="text-align: left; width: 150px;"> Townsend, Richard </div></td><td align="left"><div style="text-align: left; width: 200px;"> Circus Street Communications </div></td><td align="left"><div style="text-align: left; width: 50px;"> N </div></td><td align="left"><div style="text-align: left; width: 150px;">  </div></td><td align="left"><div style="text-align: left; width: 200px;"> <div style="display: inline; width: 200px;" class="edit_area" title="Click to edit...">click here for notes</div> </div></td></tr>
</tbody>
</table>
</div>

Open in new window

0
 
LVL 82

Accepted Solution

by:
hielo earned 500 total points
ID: 21832573
Try:
$('.bDiv #listDisplay tbody tr').addClass('trSelected');
0
 
LVL 8

Author Closing Comment

by:newbie27
ID: 31469187
thanks, this worked
0
 
LVL 8

Author Comment

by:newbie27
ID: 21832615
0
 
LVL 8

Author Comment

by:newbie27
ID: 21855435
Hello Hielo,
Please can you look into my open flexigrid issue? whenever you get the chance please have a look...
thanks
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Date on a table 16 34
ASP sending two datas 2 23
Deploy restore partition 1 26
DataTable column sorting incorrectly 2 19
This article will give core knowledge of JavaScript and will head in to your first JavaScript program. I am Durvesh Naik and I am here to deal with this series of JavaScript. I will teach you JavaScript in part wise , as its quite boring to read big…
This article is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

756 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question