Pass variable from table cell to div via jquery

classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|

Pass variable from table cell to div via jquery

Tom Parker-15
As you can tell from the subject, this is a more complicated question than I
should be posting here--but I'm stuck so here goes.  Also, if I can get this
working, I'll post an example.

My data table has a number of links from which I pull up a <div> to expand
data...up to now, I do a full page refresh and include the <div>.
Now, I'm attempting to use jquery and jqmodal plug-in to make visible a div
on the page and avoid a full
page refresh:

//Table (general structure):
<table id="links">
//iterates through records
<tr>
<td class="rounds"><a id="[$maprow->(Find:'ClientID')]" class="patient"
href="#">[$mapRow->(Find:'FirstName')] [$mapRow->(Find:'LastName']</a></td>
</tr>
</table>

//My attempt to build a function that would pass the ID to the <div>
$().ready(function() {
  $("#links").find("a.patient").click(function(){
   var linkid = this.id;
  $('#dialog').jqm();//syntax here doesn't make visible the <div> and I'm
not sure how to pass the linkid to the <div>
});

//Here is the <div> I am using:

 <div class="jqmWindow" id="dialog">

[Inline: -Database=($db), -table='Table',
'ClientID'=($id), -search][error_currenterror]
[Records]<p>Patient Information for [Field:'FirstName']
[LastName']</p>[/Records]
[/Inline]

</div>

//Obviously, I need to get the linkid javascript variable into here as $ID.
This <div> will become visible on the page when using this simple link:<a
href="#" class="jqModal">view</a>), but not when linking from the table cell
as I am trying to do above:

Questions:
--I realize this is kind of an open-ended question, so can anyone point me
to examples that are similar to what I am trying to do?  I can follow some
of the simple examples, but I get lost with all the id's and different kinds
of elements, in addition to how to pass the id from table to div.

Thanks,

--Tom Parker



--
This list is a free service of LassoSoft: http://www.LassoSoft.com/
Search the list archives: http://www.ListSearch.com/Lasso/Browse/
Manage your subscription: http://www.ListSearch.com/Lasso/

Reply | Threaded
Open this post in threaded view
|

Re: Pass variable from table cell to div via jquery

shelane
My response in parts:

1) Have you signed up for the jQuery email list?  There are quite a few of
us Lasso developers that also use jQuery, but you'll get thousands of jQuery
users on the jQuery list. http://groups.google.com/group/jquery-en

2) You're trying to use jqmodal to pop up the data after it's clicked on?

3) Have you looked at the new "dialog" module of the jQuery UI? For new
users of jQuery, the nuances of dialog are far less complicated than
jqmodal.  I'm working on making the switch from jqmodal to dialog now that
it's been released in full.
    http://ui.jquery.com

4) If you're trying to dynamically load this type of content based on the
object the user selects, you'll have to do some ajax.  So you'll have to
have another page that will accept your parameters and return the data you
need.  I have a non modal example of this: http://ajaxunited.org/
Scroll to the section that is "More Stories" and click a link.  The only
thing I didn't do in this method is provide a way to "hide" that new data
after it was retrieve.  That could be easily added.


On 6/13/08 8:15 AM, "Tom Parker" <[hidden email]> wrote:

> As you can tell from the subject, this is a more complicated question than I
> should be posting here--but I'm stuck so here goes.  Also, if I can get this
> working, I'll post an example.
>
> My data table has a number of links from which I pull up a <div> to expand
> data...up to now, I do a full page refresh and include the <div>.
> Now, I'm attempting to use jquery and jqmodal plug-in to make visible a div
> on the page and avoid a full
> page refresh:
>
> //Table (general structure):
> <table id="links">
> //iterates through records
> <tr>
> <td class="rounds"><a id="[$maprow->(Find:'ClientID')]" class="patient"
> href="#">[$mapRow->(Find:'FirstName')] [$mapRow->(Find:'LastName']</a></td>
> </tr>
> </table>
>
> //My attempt to build a function that would pass the ID to the <div>
> $().ready(function() {
>   $("#links").find("a.patient").click(function(){
>    var linkid = this.id;
>   $('#dialog').jqm();//syntax here doesn't make visible the <div> and I'm
> not sure how to pass the linkid to the <div>
> });
>
> //Here is the <div> I am using:
>
>  <div class="jqmWindow" id="dialog">
>
> [Inline: -Database=($db), -table='Table',
> 'ClientID'=($id), -search][error_currenterror]
> [Records]<p>Patient Information for [Field:'FirstName']
> [LastName']</p>[/Records]
> [/Inline]
>
> </div>
>
> //Obviously, I need to get the linkid javascript variable into here as $ID.
> This <div> will become visible on the page when using this simple link:<a
> href="#" class="jqModal">view</a>), but not when linking from the table cell
> as I am trying to do above:
>
> Questions:
> --I realize this is kind of an open-ended question, so can anyone point me
> to examples that are similar to what I am trying to do?  I can follow some
> of the simple examples, but I get lost with all the id's and different kinds
> of elements, in addition to how to pass the id from table to div.
>
> Thanks,
>
> --Tom Parker
>
>



--
This list is a free service of LassoSoft: http://www.LassoSoft.com/
Search the list archives: http://www.ListSearch.com/Lasso/Browse/
Manage your subscription: http://www.ListSearch.com/Lasso/

Reply | Threaded
Open this post in threaded view
|

(no subject)

Tami Williams
Thanks in advance.

I have some Lasso applications that work in both Lasso 6 and Lasso 8.5.

However, when I make LassoApps out of them the LassoApps work on 8.5  
BUT NOT on 6.

On Lasso 6 I get "unknown tag error" when I try to load any of them.

Why does this happen and what can I do to fix it?

Again,  the original applications (before I make them LassoApps) work  
fine on both Lasso 6 and Lasso 8.5.
Only the LassoApp versions don't work on Lasso 6.

Thanks in advance.




~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
"It's better to burn out than to fade away."

Tami Williams
Creative Computing
Improve, manage and unify data with custom database and web  
applications.
FileMaker and Lasso specialist.

Tel: 770.457.3221
Fax: 770.454.7419
E-Mail: [hidden email]
Web: http://www.asktami.com

FileMaker Solutions Alliance Associate | Lasso Professional Alliance  
Member


--
This list is a free service of LassoSoft: http://www.LassoSoft.com/
Search the list archives: http://www.ListSearch.com/Lasso/Browse/
Manage your subscription: http://www.ListSearch.com/Lasso/

Reply | Threaded
Open this post in threaded view
|

Re:

jasonhuck
Are you using Lasso 6 to create the LassoApps?




On Fri, Jun 13, 2008 at 12:31 PM, Tami Williams <[hidden email]> wrote:

> Thanks in advance.
>
> I have some Lasso applications that work in both Lasso 6 and Lasso 8.5.
>
> However, when I make LassoApps out of them the LassoApps work on 8.5 BUT NOT
> on 6.
>
> On Lasso 6 I get "unknown tag error" when I try to load any of them.
>
> Why does this happen and what can I do to fix it?
>
> Again,  the original applications (before I make them LassoApps) work fine
> on both Lasso 6 and Lasso 8.5.
> Only the LassoApp versions don't work on Lasso 6.
>
> Thanks in advance.
>
>
>
>
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> "It's better to burn out than to fade away."
>
> Tami Williams
> Creative Computing
> Improve, manage and unify data with custom database and web applications.
> FileMaker and Lasso specialist.
>
> Tel: 770.457.3221
> Fax: 770.454.7419
> E-Mail: [hidden email]
> Web: http://www.asktami.com
>
> FileMaker Solutions Alliance Associate | Lasso Professional Alliance Member
>
>
> --
> This list is a free service of LassoSoft: http://www.LassoSoft.com/
> Search the list archives: http://www.ListSearch.com/Lasso/Browse/
> Manage your subscription: http://www.ListSearch.com/Lasso/
>
>



--
tagSwap.net :: Open Source Lasso Code
<http://tagSwap.net/>

--
This list is a free service of LassoSoft: http://www.LassoSoft.com/
Search the list archives: http://www.ListSearch.com/Lasso/Browse/
Manage your subscription: http://www.ListSearch.com/Lasso/

Reply | Threaded
Open this post in threaded view
|

Re:

Bil Corry-3
In reply to this post by Tami Williams
Tami Williams wrote on 6/13/2008 11:31 AM:
> However, when I make LassoApps out of them the LassoApps work on 8.5 BUT
> NOT on 6.

You have to use Lasso 6 to create the LassoApps.  LassoApps created in Lasso 8 are not backwards compatible to run on earlier versions of Lasso.


- Bil


--
This list is a free service of LassoSoft: http://www.LassoSoft.com/
Search the list archives: http://www.ListSearch.com/Lasso/Browse/
Manage your subscription: http://www.ListSearch.com/Lasso/

Reply | Threaded
Open this post in threaded view
|

Re:

Tami Williams
In reply to this post by jasonhuck
Nope - using Lasso 8.  So, use Lasso 6, that's the answer?  Sounds  
kind of obvious now that you say it... :)


On Jun 13, 2008, at 12:23 PM, Jason Huck wrote:

> Are you using Lasso 6 to create the LassoApps?
>
>
>
>
> On Fri, Jun 13, 2008 at 12:31 PM, Tami Williams <[hidden email]>  
> wrote:
>> Thanks in advance.
>>
>> I have some Lasso applications that work in both Lasso 6 and Lasso  
>> 8.5.
>>
>> However, when I make LassoApps out of them the LassoApps work on  
>> 8.5 BUT NOT
>> on 6.
>>
>> On Lasso 6 I get "unknown tag error" when I try to load any of them.
>>
>> Why does this happen and what can I do to fix it?
>>
>> Again,  the original applications (before I make them LassoApps)  
>> work fine
>> on both Lasso 6 and Lasso 8.5.
>> Only the LassoApp versions don't work on Lasso 6.
>>
>> Thanks in advance.
>>
>>
>>
>>
>> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> "It's better to burn out than to fade away."
>>
>> Tami Williams
>> Creative Computing
>> Improve, manage and unify data with custom database and web  
>> applications.
>> FileMaker and Lasso specialist.
>>
>> Tel: 770.457.3221
>> Fax: 770.454.7419
>> E-Mail: [hidden email]
>> Web: http://www.asktami.com
>>
>> FileMaker Solutions Alliance Associate | Lasso Professional  
>> Alliance Member
>>
>>
>> --
>> This list is a free service of LassoSoft: http://www.LassoSoft.com/
>> Search the list archives: http://www.ListSearch.com/Lasso/Browse/
>> Manage your subscription: http://www.ListSearch.com/Lasso/
>>
>>
>
>
>
> --
> tagSwap.net :: Open Source Lasso Code
> <http://tagSwap.net/>
>
> --
> This list is a free service of LassoSoft: http://www.LassoSoft.com/
> Search the list archives: http://www.ListSearch.com/Lasso/Browse/
> Manage your subscription: http://www.ListSearch.com/Lasso/
>


--
This list is a free service of LassoSoft: http://www.LassoSoft.com/
Search the list archives: http://www.ListSearch.com/Lasso/Browse/
Manage your subscription: http://www.ListSearch.com/Lasso/

Reply | Threaded
Open this post in threaded view
|

Re: Pass variable from table cell to div via jquery

dguardiola
In reply to this post by shelane
> 4) If you're trying to dynamically load this type of content based  
> on the
> object the user selects, you'll have to do some ajax.

the jQuery .load function is easy to use for that kind of need

example: a links list and dynamic loading of content
i simply use this kind of links :

<ul>
<?Lassoscript
//iterating around some record set or array , could be records; or loop;

                '<li><a href="#" onclick="
                $(\'.contentdivs\').hide();
                $(\'#targetrecorddiv_'+#id+'\').load(\'\/folder/ajaxcontent.lasso\',
{param:\'$this'\', otherparam:\''Field('that')'\', lang:\''$lang'\'});
                return false;
                ">'+(#targetrecord-text-anchor)+'</a>';
                '</li>';


//iterate;
?>
</ul>

i used meaningful (i hope) variable names so you can see how to wrap  
your own solution
the tricky part is escaping characters in the generated javascript  
part of the links
(i could made mistake in this example, check your code with a  
colorized code tool like bbedit does

the ajaxcontent.lasso page would just include your dynamic content,  
without HTML headers:

[Inline: -Database=($db), -table='Table',
'ClientID'=($id), -search][error_currenterror]
[Records]<p>Patient Information for [Field:'FirstName']
[LastName']</p>[/Records]
[/Inline]

this example implies you created all the empty targetrecorddivs_id# at  
the page creation, with another loop/iterate/resultset
they will all have their unique id in order to inject the good  
content, and the same class, .contentdivs in my example

hope this helps


--
Dominique Guardiola, QUINODE
http://www.quinode.fr/




--
This list is a free service of LassoSoft: http://www.LassoSoft.com/
Search the list archives: http://www.ListSearch.com/Lasso/Browse/
Manage your subscription: http://www.ListSearch.com/Lasso/

Reply | Threaded
Open this post in threaded view
|

Re: Pass variable from table cell to div via jquery

shelane
It looks like you've included a lot of javascript code within the a tag
itself.  One of the things jQuery prides itself on is being unobtrusive.
That particular example would have that code repeating multiple times
throughout the page.  I discourage having embedded javascript except if
absolutely necessary.

I think the link I included in my post is a good example, but I'm going to
clean this up just because :-)

$(function(){
    $('a', '#mylist').click(function(){
        var paramvar = this.id;
        $('#targetdisplay').load('ajaxcontent.lasso', {paramname:
paramvar});
    }
});


<ul id="mylist">
//iteration
<li><a href="#" id="valuetopasstoserver">Text of list item<a></li>
//end iteration
</ul>


On 6/14/08 2:43 AM, "Dominique Guardiola" <[hidden email]> wrote:

>> 4) If you're trying to dynamically load this type of content based
>> on the
>> object the user selects, you'll have to do some ajax.
>
> the jQuery .load function is easy to use for that kind of need
>
> example: a links list and dynamic loading of content
> i simply use this kind of links :
>
> <ul>
> <?Lassoscript
> //iterating around some record set or array , could be records; or loop;
>
> '<li><a href="#" onclick="
> $(\'.contentdivs\').hide();
> $(\'#targetrecorddiv_'+#id+'\').load(\'\/folder/ajaxcontent.lasso\',
> {param:\'$this'\', otherparam:\''Field('that')'\', lang:\''$lang'\'});
> return false;
> ">'+(#targetrecord-text-anchor)+'</a>';
> '</li>';
>
>
> //iterate;
> ?>
> </ul>
>
> i used meaningful (i hope) variable names so you can see how to wrap
> your own solution
> the tricky part is escaping characters in the generated javascript
> part of the links
> (i could made mistake in this example, check your code with a
> colorized code tool like bbedit does
>
> the ajaxcontent.lasso page would just include your dynamic content,
> without HTML headers:
>
> [Inline: -Database=($db), -table='Table',
> 'ClientID'=($id), -search][error_currenterror]
> [Records]<p>Patient Information for [Field:'FirstName']
> [LastName']</p>[/Records]
> [/Inline]
>
> this example implies you created all the empty targetrecorddivs_id# at
> the page creation, with another loop/iterate/resultset
> they will all have their unique id in order to inject the good
> content, and the same class, .contentdivs in my example
>
> hope this helps
>
>
> --
> Dominique Guardiola, QUINODE
> http://www.quinode.fr/
>
>
>



--
This list is a free service of LassoSoft: http://www.LassoSoft.com/
Search the list archives: http://www.ListSearch.com/Lasso/Browse/
Manage your subscription: http://www.ListSearch.com/Lasso/

Reply | Threaded
Open this post in threaded view
|

Re: Pass variable from table cell to div via jquery

dguardiola

Le 15 juin 08 à 18:20, Shelane Enos a écrit :

> It looks like you've included a lot of javascript code within the a  
> tag
> itself.  One of the things jQuery prides itself on is being  
> unobtrusive.
> That particular example would have that code repeating multiple times
> throughout the page.  I discourage having embedded javascript except  
> if
> absolutely necessary.

you're perfectly right on this point, i use this in the admin section  
of my sites - my clients, the sites owners,  know they have to use the  
recommended tools (firefox/safari, javascript activated).
this example is not useable if the content you want to show has to be  
indexed by web crawlers for example
--
This list is a free service of LassoSoft: http://www.LassoSoft.com/
Search the list archives: http://www.ListSearch.com/Lasso/Browse/
Manage your subscription: http://www.ListSearch.com/Lasso/

Reply | Threaded
Open this post in threaded view
|

Re: Pass variable from table cell to div via jquery

Tom Parker-15
In reply to this post by Tom Parker-15
Thanks Dominique and Shelane.  For now, I have my data available on the
page, so for simpler data it is just a matter of targeting the correct <div>
element from the correct table row/cell (example, click icon and make
visible a <div> showing full message text).

For more complex data, I will need to use AJAX...either that or wrestle with
nested iterations through complex data types (for example, click "history"
button in one table cell and show a data table with multiple rows and
columns).

You've pointed me in some great directions and I am now digesting the book
JQuery in Action and will start looking in on the jquery groups.

--Tom

----- Original Message -----
From: "Dominique Guardiola" <[hidden email]>
To: "Lasso Talk" <[hidden email]>
Sent: Saturday, June 14, 2008 3:43 AM
Subject: Re: Pass variable from table cell to div via jquery


>> 4) If you're trying to dynamically load this type of content based  on
>> the
>> object the user selects, you'll have to do some ajax.
>
> the jQuery .load function is easy to use for that kind of need
>
> example: a links list and dynamic loading of content
> i simply use this kind of links :
>
> <ul>
> <?Lassoscript
> //iterating around some record set or array , could be records; or loop;
>
> '<li><a href="#" onclick="
> $(\'.contentdivs\').hide();
> $(\'#targetrecorddiv_'+#id+'\').load(\'\/folder/ajaxcontent.lasso\',
> {param:\'$this'\', otherparam:\''Field('that')'\', lang:\''$lang'\'});
> return false;
> ">'+(#targetrecord-text-anchor)+'</a>';
> '</li>';
>
>
> //iterate; ?>
> </ul>
>
> i used meaningful (i hope) variable names so you can see how to wrap  your
> own solution
> the tricky part is escaping characters in the generated javascript  part
> of the links
> (i could made mistake in this example, check your code with a  colorized
> code tool like bbedit does
>
> the ajaxcontent.lasso page would just include your dynamic content,
> without HTML headers:
>
> [Inline: -Database=($db), -table='Table',
> 'ClientID'=($id), -search][error_currenterror]
> [Records]<p>Patient Information for [Field:'FirstName']
> [LastName']</p>[/Records]
> [/Inline]
>
> this example implies you created all the empty targetrecorddivs_id# at
> the page creation, with another loop/iterate/resultset
> they will all have their unique id in order to inject the good  content,
> and the same class, .contentdivs in my example
>
> hope this helps
>
>
> --
> Dominique Guardiola, QUINODE
> http://www.quinode.fr/
>
>
>
>
> --
> This list is a free service of LassoSoft: http://www.LassoSoft.com/
> Search the list archives: http://www.ListSearch.com/Lasso/Browse/
> Manage your subscription: http://www.ListSearch.com/Lasso/
>
>
>



--
This list is a free service of LassoSoft: http://www.LassoSoft.com/
Search the list archives: http://www.ListSearch.com/Lasso/Browse/
Manage your subscription: http://www.ListSearch.com/Lasso/