views:

48

answers:

1

Sorry if this is a newbie question. I have searched but found nothing...

Using Python on GAE, I will display a table of, say, customers on an HTML table. The table will show their name and phone number.

I want the user to double-click on a row and have the python Post() method know either the row number double-clicked or the customer number of that row. A 'Select' button on each row would be an acceptable alternative to the double-click.

(I am trying to replicate or simulate the Windows / Delphi double-click event on a TStringgrid).

My question: is this possible? If so, how or where should I look?

many thanks David

+3  A: 

I have never used Python or Delphi (assuming by "I come from Delphi" you mean you are using the Delphi programming language) so forgive me if my answer is not relevant.

One method you could use is to give each tr a custom attribute. For example <tr custID='...'>...</tr>. You could then use jQuery to extract the custID from the tr on double click.

For example:

$("tr").dblclick(function() {
    $(selector).load("http://myurl/pageName.extension?custID='"+$(this).attr("custID")+"'");
});

I think this should do what you want. I have never used the POST method in jQuery, but this would work for GET. You can always look up the POST method on the jQuery website.

Edit:

For compliance with HTML 5 (although it will be non-compliant with HTML 4) you are recommended to use data- attributes, for example data-custID.

ClarkeyBoy
Thanks (belated, sorry) for your response. Very much appreciated.
David Freeman
No problem. Glad to help.
ClarkeyBoy