使用ui活页夹时在gwt中迭代li项

使用ui活页夹时在gwt中迭代li项,gwt,uibinder,Gwt,Uibinder,我的ui.xml中有一个无序列表。有没有一种方法可以遍历列表项 只有列表项 在我的owner类中,以便在发生某些事件时从某些li项中删除样式。就像jquery中的每个$ ul在my ui.xml中的布局方式>> 如果有人偶然发现相同的场景,请使用getElementsByTagNameli 上述方法将返回li元素的节点列表。 从列表中访问所需的元素,并使用addClassName添加指定的样式 @UiField UListElement bCrumbHeader; private

我的ui.xml中有一个无序列表。有没有一种方法可以遍历列表项

只有列表项 在我的owner类中,以便在发生某些事件时从某些li项中删除样式。就像jquery中的每个$

ul在my ui.xml中的布局方式>>


如果有人偶然发现相同的场景,请使用getElementsByTagNameli

上述方法将返回li元素的节点列表。 从列表中访问所需的元素,并使用addClassName添加指定的样式

 @UiField
 UListElement bCrumbHeader;

    private void iterateThroughList{

     //bCrumbHeader is the uifield associated with ul
     NodeList<Element> eList= bCrumbHeader.getElementsByTagName("li");

     for(int i = 0; i < eLsit.getLength(); i++) { 

             Element aNode = eLsit.getItem(i); 
             aNode.addClassName(style.active());
        }
    }
    @UiField
    UListElement bCrumbHeader;

private void iterateThroughList{
//some logic so that I can access each li item inside a loop
}
 @UiField
 UListElement bCrumbHeader;

    private void iterateThroughList{

     //bCrumbHeader is the uifield associated with ul
     NodeList<Element> eList= bCrumbHeader.getElementsByTagName("li");

     for(int i = 0; i < eLsit.getLength(); i++) { 

             Element aNode = eLsit.getItem(i); 
             aNode.addClassName(style.active());
        }
    }