/** * Reduce the set of matched elements to the first in the set. */ public GQuery first() { return eq(0); }
/** * Set the id of the first matched element. */ public GQuery id(String id) { return eq(0).attr("id", id); }
/** * Reduce the set of matched elements to the final one in the set. */ public GQuery last() { return eq(size() - 1); }
/** * Sets the value attribute of every matched element based in the return value of the function * evaluated for this element. * * NOTE: in jquery the function receives the arguments in different way, first index and them the * actual value, but we use the normal way in gquery Function, first the element and second the * index. */ public GQuery val(Function f) { for (int i = 0; i < size(); i++) { eq(i).val(f.f(get(i), i).toString()); } return this; }
public void removeGroup(int index) { $(OPTGROUP_TAG, getElement()).eq(index).remove(); update(); }
public void removeGroup(int index){ $(OPTGROUP_TAG, getElement()).eq(index).remove(); update(); }
public void removeGroup(int index) { $(OPTGROUP_TAG, getElement()).eq(index).remove(); update(); }
/** * Insert a group to the list box. * * @param label the text of the group to be added * @param id the id of the optgroup element * @param index the index at which to insert it */ public void insertGroup(String label, String id, int index) { GQuery optGroup = $("<optgroup></optgroup>").attr("label", label); if (id != null) { optGroup.attr("id", id); } GQuery select = $(getElement()); int itemCount = SelectElement.as(getElement()).getLength(); if (index < 0 || index > itemCount) { select.append(optGroup); } else { GQuery before = select.children().eq(index); before.before(optGroup); } }
/** * Insert a group to the list box. * * @param label the text of the group to be added * @param id the id of the optgroup element * @param index the index at which to insert it */ public void insertGroup(String label, String id, int index) { GQuery optGroup = $("<optgroup></optgroup>").attr("label", label); if (id != null) { optGroup.attr("id", id); } GQuery select = $(getElement()); int itemCount = SelectElement.as(getElement()).getLength(); if (index < 0 || index > itemCount) { select.append(optGroup); } else { GQuery before = select.children().eq(index); before.before(optGroup); } }
/** * Insert a group to the list box. * * @param label the text of the group to be added * @param id the id of the optgroup element * @param index the index at which to insert it */ public void insertGroup(String label, String id, int index) { GQuery optGroup = $("<optgroup></optgroup>").attr("label", label); if (id != null){ optGroup.attr("id", id); } GQuery select = $(getElement()); int itemCount = SelectElement.as(getElement()).getLength(); if (index < 0 || index > itemCount) { select.append(optGroup); } else { GQuery before = select.children().eq(index); before.before(optGroup); } }
GQuery optgroup = optgroupList.eq(pos);
GQuery optgroup = optgroupList.eq(pos);