Avatar of newbie27
newbie27
Flag for United Kingdom of Great Britain and Northern Ireland asked on

Jquery facebox plugin in Flexigrid

Hello Experts,
I am using Jquery plugin Facebox to allow user to enter extra info for one of the field in the Flexigrid.
All it does is when you click an icon a dialog will appear, once can enter some  text and close by pressing OK. The entered text will be shown back in the cell. It works just fine. However, on the same click the entire row is getting selected which I want to deselect it soon you close facebox.
Please see the attached screenshot for better understanding of what I am trying to say you here.
I hope someone can help?
Thanks
Sam
JavaScriptASP

Avatar of undefined
Last Comment
b0lsc0tt

8/22/2022 - Mon
newbie27

ASKER
please see the attached or if you can please visit the url
http://213.253.134.6/artism/admin/list_admin.asp#istest

screenshot.jpg
b0lsc0tt

How is the Deselect option run?  Could that be used onclose of Facebox to deselect the item?  If you need specific help with that could you help to point to the code that "runs" when Deselect is pressed.

bol
newbie27

ASKER
Hello,
Thanks for your comment, there is a class for the Flexigrid row,

I have used the below statement to deselect all the selected rows
$('.bDiv tbody tr',grid).removeClass('trSelected');

I think I can use the same when I close the Facebox but did not worked for me

i think i am unable to pick the 'grid' value, which I believe is the Flexigrid name.

Please can you advice

thanks for your help
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes
b0lsc0tt

OK.  I was looking and thinking on the same lines.  I was wondering what grid came from and could see  that as a problem but a line like the one above at the start of the saveData function (the one called onclose of Facebox) is just what we need.  Let me look at the html to see if I can find a way to reference the tr tag we need.  The  removeClass is what we will use either way.

Hopefully I can find another way to do it without using grid but it might be nice if you could figure out what that does in the jQuery above.

bol

bol
b0lsc0tt

Can you just leave grid out?  I am not sure why it is needed and that would probably be the easiest way to do it, just clear all tr tags of using that class in the table.

Add the line above to the saveData function but leave out grid.

$('.bDiv tbody tr').removeClass('trSelected');

Let me know how that works.

bol
newbie27

ASKER
Thanks Bol,

this is equivalent
$('.bDiv tbody tr',grid).removeClass('trSelected');

to this
  $('.bDiv tbody tr','listDisplay').removeClass('trSelected');

I tried adding this line in the saveData function after adding the text to the cell but is not doing it

thanks for your help




function saveData(d)
	{
          if(!orig[d]){
            orig[d]=$("#"+d).html();
          }
		  
		 // alert(d); 
          if($("#theText").val() != ''){
                $("#"+d).html( $("#theText").val() )
			   //$("#"+d).html( orig[d] + "  " + $("#theText").val() )
          }
          else{
                $("#"+d).html( orig[d] );
          }
		    $('.bDiv tbody tr','listDisplay').removeClass('trSelected');
	}	
		

Open in new window

⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
newbie27

ASKER
Thanks Bol,
tried as you suggested above but that did not work either...
ASKER CERTIFIED SOLUTION
b0lsc0tt

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
newbie27

ASKER
thanks
newbie27

ASKER
Bol,
This has worked, I was adding the line in a wrong place....
thanks for your help
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck
b0lsc0tt

Your welcome!  I made a small test page to see if how the jQuery would work and it seemed to be good.  I am glad it was just the wrong place.  Thanks for the grade, the points and the fun question.

bol