dynamic data reload to struts2 jquery grid on form submit

后端 未结 3 386
一整个雨季
一整个雨季 2021-01-27 02:28

I have a grid which load data on page load. I also have a form that on submit calls an action correctly, but it doesn\'t load new data on my grid.

List is correctly get

相关标签:
3条回答
  • 2021-01-27 03:01

    I guess this is what you require :

    1. Instead of using a sj:submit tag, use a sj:a tag with onClickTopics pointing to GridReloadTopics.

    2. Then when sj:a is clicked, the grid get's reloaded, submitting the form to action defined in href attribute of grid.

    3. This action must result a JSON which will populate the grid.

    You haven't shown the action "getCurrentDateLogs" in the question. So this is the action that must return the json result populating the grid.

    Also you must be thinking that how the grid-data gets affected by the form fields, so it's easy

    1. The grid submits all the form fields to the action mentioned in href, so you must be having a getter & setter for every form field on that action.

    2. Along with other normal grid attributes, now you'll receive the additional form attributes, based on the value of which you'll fill up the gridModel.

    Please let me know if you still didnt' understood.

    0 讨论(0)
  • 2021-01-27 03:09

    It doesn't work this way. try do the following things:

    1. make an action retuen a page, not json

      <result name="success">page_with_the_grid.jsp</result>
      
    2. on the page page_with_the_grid.jsp, use s:url tag to map your json result:

      <s:url var="jsonUrl" action="jsonAction"/>
      
    3. in your sj:grid, use href="%{jsonUrl}" to fill your data to the grid.

    if you directly call the action, which returns JSON, you will sure get a json result, which is your "Strange" output.

    0 讨论(0)
  • 2021-01-27 03:15

    I have find Two grid after submit the form one is old one and second one my search grid it also include whole page

    <sj:a  href="%{form}" targets="result" indicator="indicator" button="true" buttonIcon="ui-icon-refresh"/>
    
    0 讨论(0)
提交回复
热议问题