0

How to show Data In Previous ZUL Page?

asked 2012-01-01 19:16:16 +0800

GuzZpaWn gravatar image GuzZpaWn
111 2

updated 2013-01-23 11:56:35 +0800

sjoshi gravatar image sjoshi flag of India
3493 1 8
http://zkframeworkhint.bl...

Hi, I want to do the following: click me pressing INTRO and when i get txtPrecio and press INTRO it must jump to the next row and this way till the end.

This is the code: (any suggestion) I'm using ZK 5.0.9 CE

  <window id="win" title="Cotizaci├│n" width="100%"  height="100%"
    apply="pbz.ctrl.tran.cotiz.CotizacionWINCtrl">
<listbox id="listbox" width="100%" height="450px" mold="paging" pageSize="10" pagingPosition="top">
    <listhead>
      <listheader label="Producto" width="100%"></listheader>
      <listheader label="Unidad" width="100px"></listheader>
      <listheader label="Cantidad" width="70px"></listheader>
      <listheader label="Precio" width="60px"></listheader>
      <listheader label="SubTotal" width="100px"></listheader>
    </listhead>
    <listfoot>
      <listfooter><label value=""></label></listfooter>
      <listfooter><label value=""></label></listfooter>
      <listfooter><label value=""></label></listfooter>
      <listfooter><label value="Total"></label></listfooter>
      <listfooter><label id="lblTotal"></label></listfooter>
    </listfoot>
  </listbox>
</window>



 public class ListCotizacionRender implements ListitemRenderer {

  public void render(Listitem lstm, Object o) throws Exception {
    final cotizaciondetaVO x=(cotizaciondetaVO)o;
    final Textbox txtCantidad=new Textbox("0.0");
    final Textbox txtPrecio=new Textbox("0.0");
    final Label lblSubTotal=new Label("0.0");


    txtCantidad.addEventListener(Events.ON_OK, new EventListener(){
      public void onEvent(Event event) throws Exception {
        txtPrecio.focus();
      }
    });
    txtCantidad.addEventListener(Events.ON_FOCUS, new EventListener(){
      public void onEvent(Event event) throws Exception {
        txtCantidad.select();
      }
    });

    txtPrecio.addEventListener(Events.ON_FOCUS, new EventListener(){
      public void onEvent(Event event) throws Exception {        
          txtPrecio.focus();
      }
    });

    txtCantidad.addEventListener(Events.ON_CHANGE, new EventListener(){
      public void onEvent(Event event) throws Exception {
        Double cantidad=0.0;
        Double precio=0.0;
        Double subtotal=0.0;

        if(Util.isDouble(txtCantidad.getValue()))          
          cantidad=Double.parseDouble(txtCantidad.getValue());
        else
          txtCantidad.setValue("0.0");

        if(Util.isDouble(txtPrecio.getValue()))
          precio=Double.parseDouble(txtPrecio.getValue());
        else
          txtPrecio.setValue("0.0");

        subtotal=cantidad*precio;
        lblSubTotal.setValue(subtotal.toString());

        x.setCantidad(BigDecimal.valueOf(cantidad));
        x.setPrecio(BigDecimal.valueOf(precio));
        x.setSubtotal(BigDecimal.valueOf(subtotal));
      }
    });
    txtPrecio.addEventListener(Events.ON_CHANGE, new EventListener(){
      public void onEvent(Event event) throws Exception {
                Double cantidad=0.0;
        Double precio=0.0;
        Double subtotal=0.0;

        if(Util.isDouble(txtCantidad.getValue()))          
          cantidad=Double.parseDouble(txtCantidad.getValue());
        else
          txtCantidad.setValue("0.0");

        if(Util.isDouble(txtPrecio.getValue()))
          precio=Double.parseDouble(txtPrecio.getValue());
        else
          txtPrecio.setValue("0.0");

        subtotal=cantidad*precio;
        lblSubTotal.setValue(subtotal.toString());

        x.setCantidad(BigDecimal.valueOf(cantidad));
        x.setPrecio(BigDecimal.valueOf(precio));
        x.setSubtotal(BigDecimal.valueOf(subtotal));
      }
    });

    Listcell cell = new Listcell(x.getProducto());
    cell.setParent(lstm);

    cell=new Listcell(x.getUnidad());
    cell.setParent(lstm);

    cell = new Listcell();    
    cell.appendChild(txtCantidad);
    cell.setParent(lstm);

    cell = new Listcell();
    cell.appendChild(txtPrecio);
    cell.setParent(lstm);

    cell=new Listcell();
    cell.appendChild(lblSubTotal);
    cell.setParent(lstm);

  }  
}
delete flag offensive retag edit

1 Reply

Sort by ┬╗ oldest newest

answered 2012-02-02 02:07:03 +0800

hawk gravatar image hawk
2255 1 5
http://hawkphoenix.blogsp... ZK Team

updated 2013-01-23 09:43:48 +0800

Hi, I guess your requirement is when a user clicks "ENTER" key in a Textbox, the cursor change to next row's Textbox, right? I think you can use

//inside Textbox's onOK event handler
  Event.getTarget()

to get the textbox in a row and use relative path to navigate to next row's textbox (i.e., textbox.getParent().getNextSibling() ) and call focus().

link publish delete flag offensive edit

answered 2013-01-23 15:29:46 +0800

neillee gravatar image neillee flag of Taiwan
1692 1 5
https://plus.google.com/u...

The requirement is similar to a previous post.

link publish delete flag offensive edit
Your reply
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow

RSS

Stats

Asked: 2012-01-01 19:16:16 +0800

Seen: 130 times

Last updated: Jan 23 '13

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More