jQuery UI Widgets Forums Grid Entities with composite primary keys

This topic contains 3 replies, has 2 voices, and was last updated by  Dimitar 9 years, 2 months ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
  • Entities with composite primary keys #69202

    slbtuga
    Participant

    I

    Some one can tell me if the Grid/Tree Grid support entities with composite primary keys?
    If so, can you show me how do that?
    Thanks
    Regards

    Entities with composite primary keys #69227

    Dimitar
    Participant

    Hello slbtuga,

    jqxGrid and jqxTreeGrid load the data passed to them through the jqxDataAdapter plug-in. The actual relations of tables in the database is of no concern to the widgets, except if you wish to have a “foreign key” column, as in the following demo: http://www.jqwidgets.com/jquery-widgets-demo/demos/jqxgrid/foreignkeycolumn.htm?arctic.

    Best Regards,
    Dimitar

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

    Entities with composite primary keys #69271

    slbtuga
    Participant

    I was thinking about update and delete in server side.
    When the Grid call server (in my case asp.net mvc) for deletion/update, only send one id about the row in question specified by “id” property defined in source of dataAdapter, right?
    How I delete/update some entity if have more than one primary key?

    Regards.

    • This reply was modified 9 years, 2 months ago by  slbtuga.
    Entities with composite primary keys #69293

    Dimitar
    Participant

    Hi slbtuga,

    The grid can send other data apart from the id, too. In fact, when updating a row you will need to send all its data to the server. This can be done for the delete operation, too. You can then use the row data however you like on your server-side. Here is a part of the Build CRUD Web App with jqxGrid using PHP and MySQL example that shows how to send the complete row data to the server when a row is updated:

    updaterow: function(rowid, rowdata, commit) {
        // synchronize with the server - send update command
        var data = "update=true&" + $.param(rowdata);
        $.ajax({
            dataType: 'json',
            url: 'data.php',
            cache: false,
            data: data,
            success: function(data, status, xhr) {
                // update command is executed.
                commit(true);
            },
            error: function(jqXHR, textStatus, errorThrown) {
                commit(false);
            }
        });
    }

    Best Regards,
    Dimitar

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

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

You must be logged in to reply to this topic.