Forum

November 2nd, 2014
A A A
Avatar

Lost password?
Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

The forums are currently locked and only available for read only access
sp_Feed Topic RSS sp_TopicIcon
About Struts2 jquery plugin
16/01/2010
17:27
Avatar
bicho
New Member
Members
Forum Posts: 1
Member Since:
16/01/2010
sp_UserOfflineSmall Offline

Hi


I was trying to make a simple editable grid like this

   http://code.google.com/p/strut.....i/EditGrid

but when I make a click on the delete button, it dosen't send any value to the action

 I did it:

JSP:

     <sj:head useJqGridPlugin="true" jqueryui="true" jquerytheme="redmond"/>
        <br/>

        <s:url id="remoteurl" action="jsontable"/>
        <s:url id="editurl" action="edit-grid-entry"/>
    <sj:grid
        id="gridedittable"
        caption="Customer Examples (zazaza)"
        dataType="json"
        href="%{remoteurl}"
        pager="true"
        navigator="true"
        navigatorSearchOptions="{sopt:['eq','ne','lt','gt']}"
        navigatorAddOptions="{height:280,reloadAfterSubmit:true}"
        navigatorEditOptions="{height:280,reloadAfterSubmit:false}"
        navigatorEdit="false"
        navigatorView="false"
        navigatorDelete="true"
        navigatorDeleteOptions="{height:280,reloadAfterSubmit:true}"
        gridModel="gridModel"
        rowList="10,15,20"
        rowNum="15"
        editurl="%{editurl}"
        editinline="true"
        onSelectRowTopics="rowselect"
       
    >

        <sj:gridColumn id="id_auditorio" name="id_auditorio" index="id_auditorio" title="id_auditorio" formatter="integer" sortable="false"/>
        <sj:gridColumn id="nombre" name="nombre" index="nombre" title="nombre" editable="true" edittype="text" sortable="true" search="true"/>
        <sj:gridColumn id="descripcion" name="descripcion" index="descripcion" title="descripcion" sortable="false" editable="true" search="false"/>

    </sj:grid>

Struts.xml

<struts>
    <package name="jeck" extends="struts-default,json-default" namespace="/">

        <action name="jsontable" class="com.action.JsonTable">
             <result name = "success" type = "json"/>
         </action>

         <action name="edit-grid-entry" class="com.action.EditGridEntry">
            <result>newjsp.jsp</result>
            <result name="input">newjsp.jsp</result>
         </action>

    </package>
</struts>

And the class to edit the grid

public class EditGridEntry extends ActionSupport {

  private String oper;
  int id_auditorio;
  String nombre;
  String descripcion;

  @Actions( {
    @Action(value = "/edit-grid-entry", results = {
        @Result(location = "newjsp.jsp", name = "success"), @Result(location = "newjsp.jsp", name = "input")
    })
  })

          @Override
  public String execute() throws Exception{
        System.out.println("oper: "+oper);
        Auditorio auditorio;
        if (oper.equals("add"))
        {
        //  log.debug("Add Auditorio");
          auditorio = new Auditorio();
          auditorio.setNombre(getNombre());
          auditorio.setDescripcion(getDescripcion());
          auditorio.setId_auditorio(id_auditorio);

          System.out.println("AuditorioDAO.save(auditorio);");
        }
        else if (oper.equals("edit"))
        {
          //log.debug("Edit Auditorio");
           System.out.println("AuditorioDAO.update(auditorio);");
          //auditorio = AuditorioDAO.findById(null,getId_auditorio());
          //auditorio.setNombre(getNombre());
          //auditorio.setDescripcion(getDescripcion());

        
        }
        else if (oper.equals("del"))
        {
            System.out.println(getId_auditorio());
            System.out.println(getNombre());
            System.out.println(getDescripcion());
            System.out.println("AuditorioDAO.delete(auditorio);");
            //auditorio = AuditorioDAO.findById(null,getId_auditorio());
           
          }
           return SUCCESS;
    }

    public String getDescripcion() {
        return descripcion;
    }

    public void setDescripcion(String descripcion) {
        this.descripcion = descripcion;
    }

    public int getId_auditorio() {
        return id_auditorio;
    }

    public void setId_auditorio(int id_auditorio) {
        this.id_auditorio = id_auditorio;
    }

    public String getNombre() {
        return nombre;
    }

    public void setNombre(String nombre) {
        this.nombre = nombre;
    }

    public String getOper() {
        return oper;
    }

    public void setOper(String oper) {
        this.oper = oper;
    }

  }

I hope that someone can help me, thanks a lot Laugh

18/01/2010
08:54
Avatar
jogep
Germany
Member
Members
Forum Posts: 23
Member Since:
14/01/2010
sp_UserOfflineSmall Offline

A good way to find out what jqGrid sends to the Server is to use Firbug or similar tools.

Choose Network -> XHR and try to delete your Grid Entry.

In the Post Tab of your Request you can see the paramters.

I sugegst that the ID always has the Name id and not id_auditorio.

Hope it helps

Johanens Geppert

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

Currently Online:
59 Guest(s)

Top Posters:

OlegK: 1255

markw65: 179

kobruleht: 144

phicarre: 132

YamilBracho: 124

Renso: 118

Member Stats:

Guest Posters: 447

Members: 11373

Moderators: 2

Admins: 1

Forum Stats:

Groups: 1

Forums: 8

Topics: 10592

Posts: 31289

Newest Members:

, razia, Prankie, psky, praveen neelam, greg.valainis@pa-tech.com

Moderators: tony: 7721, Rumen[Trirand]: 81

Administrators: admin: 66

Comments are closed.
Privacy Policy   Terms and Conditions   Contact Information