i would like to have a datatable on different clients that is in sync.
theres a chat application here:
http://www.hascode.com/2013/08/creating-a-chat-application-using-java-ee-7-websockets-and-glassfish-4/
that basically does what i need.
each connected client gets all the messages via websocket.
so i created a primefaces dataTable (modified example from the primefaces page):
<h:form>
<p:dataTable id="carTable" var="car" value="#{dtSortView.cars1}">
<p:column headerText="Remove">
<h:outputText value="testing" />
<p:commandButton icon="ui-icon-close" title="testbotton" type="submit"/>
....
</h:form>
i register the function dosomething2() here:
$(document).ready(function() {
$('#carTable').submit(function(evt) {
evt.preventDefault();
dosomething2()
});
});
and dosomething2 is defined like this:
function dosomething2(data) {
alert('domsomething 22123');
}
but the alert never shows. why is it not called when i click the button?
what i want to achieve:
the user clicks a button in the table,
the line is removed immediately in the table and the table is updated,
all other connected clients get sent the same command via websocket (the websocket would be called from dosomething2)
i could be completely wrong with this idea, im open to suggestions.