Skip to content

Update specific row from javascript #1111

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
usingh075 opened this issue May 9, 2018 · 0 comments
Open

Update specific row from javascript #1111

usingh075 opened this issue May 9, 2018 · 0 comments

Comments

@usingh075
Copy link

I am displaying a grid like this and I have a button. Every time I click this button I want update a specific row lets say with ID:5

$("#clickme").click(function (e) {
//logic to update row with ID 2

});

var clients = [];
for(var i=1;i<=10;i++) {
var client = {ID: i, "Name": "Otto Clay" + i, "Age": 25, "Country": 1, "Address": "Ap #897-1459 Quam Avenue", "Married": false };
clients.push(client);
}

var countries = [
    { Name: "", Id: 0 },
    { Name: "United States", Id: 1 },
    { Name: "Canada", Id: 2 },
    { Name: "United Kingdom", Id: 3 }
];

$("#jsGrid").jsGrid({
    width: "100%",
    height: "400px",

    inserting: true,
    sorting: true,
    paging: true,
    pageIndex: 1,
    pageSize: 10,

    data: clients,
    controller:{
        updateItem: function(item) {
            console.log(item);
        }
    },
    fields: [
        { name: "Name", type: "text", width: 150, validate: "required" },
        { name: "Age", type: "number", width: 50 },
        { name: "Address", type: "text", width: 200 },
        { name: "Country", type: "select", items: countries, valueField: "Id", textField: "Name" },
        { name: "Married", type: "checkbox", title: "Is Married", sorting: false },
        { type: "control" }
    ]
});
@usingh075 usingh075 reopened this May 9, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant