Hi Wai and Jon,
I think I find the problem now.
I have two table rows, row1 column1, row2 column1.
I set table column1 with class identifier 'medSearch'
and have autocomplet on column 1 then.
For first row, it works fine.
For second row, my autocomplete code triggered as well.
But in my autocomplete code, I need to get row2 column1's user input as search criteria.
However, in my code I use
var searchStr = $(".medSearch").val();
Then it always return the first item which has .medSearch class identifier, then I will always get the same search string. then then the same result. How can I set the html properties to have the value form the current row?
Thank you for your help in advance.
continue on autocomplete for table column
Moderators: Jon, Steve, Ian, Dave
-
- Ebase User
- Posts: 272
- Joined: Fri Dec 14, 2012 2:55 pm
- Location: Ottawa
-
- Moderator
- Posts: 1342
- Joined: Wed Sep 12, 2007 12:49 pm
-
- Ebase User
- Posts: 272
- Joined: Fri Dec 14, 2012 2:55 pm
- Location: Ottawa
Hi Jon,
Thank you for your reply.
I received help from other forum about javascript and jquery.
The way of doing it is use the following in my autocomplete code.
var searchStr = request.term;
It works fine for that part.
But I am facing the other problem: there are other two columns need to be populated by the result of the autocomplete. I use .medCode and medDin as class identifier for these two columns. and the code in autocomplete is
myTable.push({
label: $(childList[0]).text() + " - " + $(childList[2]).text(),
value: $(childList[0]).text(),
din: $(childList[2]).text(),
code: $(childList[1]).text()
});
select: function(event,ui) {
$(".medCode").val(ui.item.code);
$(".medDin").val(ui.item.din);
},
Then after I select one item in the list, the two columns of all rows are set with value corresponding to the current selected item.
I think it is similar to my previous question.
If you have any idea about how to fix it please let me know.
Thank you,
Xiaoli
Thank you for your reply.
I received help from other forum about javascript and jquery.
The way of doing it is use the following in my autocomplete code.
var searchStr = request.term;
It works fine for that part.
But I am facing the other problem: there are other two columns need to be populated by the result of the autocomplete. I use .medCode and medDin as class identifier for these two columns. and the code in autocomplete is
myTable.push({
label: $(childList[0]).text() + " - " + $(childList[2]).text(),
value: $(childList[0]).text(),
din: $(childList[2]).text(),
code: $(childList[1]).text()
});
select: function(event,ui) {
$(".medCode").val(ui.item.code);
$(".medDin").val(ui.item.din);
},
Then after I select one item in the list, the two columns of all rows are set with value corresponding to the current selected item.
I think it is similar to my previous question.
If you have any idea about how to fix it please let me know.
Thank you,
Xiaoli
0 x
-
- Moderator
- Posts: 1342
- Joined: Wed Sep 12, 2007 12:49 pm
Xiaoli,
You need to address these extra columns via jQuery by navigating up to the table row - <tr> - then navigating back down to the correct cell. Will be something like this:
The exact sequence of parent() calls might need to be changed to match your form - you should be able to see this in the HTML source.
Regards
Jon
You need to address these extra columns via jQuery by navigating up to the table row - <tr> - then navigating back down to the correct cell. Will be something like this:
Code: Select all
$(this).parent().parent("td").parent("tr").find(".medCode").val(ui.item.code);
Regards
Jon
0 x
-
- Ebase User
- Posts: 272
- Joined: Fri Dec 14, 2012 2:55 pm
- Location: Ottawa
-
- Ebase User
- Posts: 272
- Joined: Fri Dec 14, 2012 2:55 pm
- Location: Ottawa
Continue:
Or my question is: what is the different of
calling insertrow to med table in before page script and in the script after the form is rendered and user clicks add button.
The auto complete works fine on the rows for first case but stopped working totally after user clicked add button - a new row is added.
Xiaoli
Or my question is: what is the different of
calling insertrow to med table in before page script and in the script after the form is rendered and user clicks add button.
The auto complete works fine on the rows for first case but stopped working totally after user clicked add button - a new row is added.
Xiaoli
0 x
Who is online
Users browsing this forum: No registered users and 28 guests