jQuery UI Widgets Forums Grid Binding "Fake" Column to Grid and Using in HTML Form

This topic contains 7 replies, has 3 voices, and was last updated by  speschka 10 years, 7 months ago.

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author

  • speschka
    Participant

    I have two questions about the grid:

    1. I want to be able to have a checkbox as the first column in the grid, so that users can “select” items for me to do something with. There’s no actual data in my JSON data set for this column, so I basically want a “fake” column to be used. Also, what I’d really like is to have a standard checkbox appear above the column and a person can check or uncheck it and it would check or uncheck all of the checkboxes in the grid. Is there a way to do this, or do I need to muck up my data source to try and add another fake data element for my fake checkbox?

    2. Is there a way to assign a “name” value to the cell contents in way that it could be used as part of a standard HTML form? So basically taking the client side content and using it server side, which requires me to be able to see a) which items were checked for processing and then b) what the values are of each of the cells in that row. Possible?

    Thanks.


    speschka
    Participant

    Sorry…I just found the selectionmode property for the grid, which is perfect for problem #1. Can you tell me about #2 though – how we can plug those values through in a form post so I can work with the values of the selected rows in a code behind? Should I just scour your site for PHP examples?


    Dimitar
    Participant

    Hello speschka,

    Please take a look at the tutorials in the PHP Integration section in the Documentation page, such as Bind jQuery Grid to MySql Database using PHP. More PHP examples can be found in the jQWidgets download package (under phpdemos) and in the Demo page. We hope they are helpful to you.

    Best Regards,
    Dimitar

    jQWidgets team
    http://www.jqwidgets.com/


    speschka
    Participant

    Hi Dimitar, the PHP example and others I’ve found are about binding data from a data source to populate the grid. In this case I’ve already done that and populated the grid, but it is contained within a form element on the page, and I need to be able to do a postback and see the values that were in the grid for each cell in each selected row. I have not found any examples on your site yet that discuss this. Does that make sense?


    Dimitar
    Participant

    Hi speschka,

    Please refer to the following: Build CRUD Web App with jqxGrid using PHP and MySQL and Registration Form.

    Best Regards,
    Dimitar

    jQWidgets team
    http://www.jqwidgets.com/


    speschka
    Participant

    Thanks, but again, your example for PHP uses jQuery to submit changes, it does not do an HTML form submit. The registration form does a submit, but it does not use the grid it just uses simple text boxes that exist on the page and load time so of course that’s not difficult at all. Not sure why this question is not clear.


    Peter Stoev
    Keymaster

    Hi speschka,

    Let me try to help with this one:

    I will try to explain how to submit the Grid with a Form instead of through Ajax. If you wish to submit the Grid, cell value or multiple values through a standard Form submit, you can do the following:

    – Add a Hidden Text Input to your Form with “name” attribute.
    – Fill that Hidden Text Input with Values which you get from the Grid. You can use the Grid’s “getcellvalue” method to get the value of a cell or if you wish you can get the Array of rows loaded into the Grid by using its “getrows” method.

    Hope this help you.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com


    speschka
    Participant

    Thanks Peter, a combination of what you describe along with getselectedrowindexes gave me a path forward. Appreciate it.

    Steve

Viewing 8 posts - 1 through 8 (of 8 total)

You must be logged in to reply to this topic.