dimanche 1 novembre 2020

How to add a button in jsgrid table that fetched data onclick

$("#jsgrid-basic").jsGrid({
            height: "500px",
            width: "100%",
            filtering: true,
            editing: true,
            inserting: true,
            sorting: true,
            paging: true,
            autoload: true,
            pageSize: 15,
            pageButtonCount: 5,
            deleteConfirm: "Do you really want to delete the client?",
            controller: db,
            fields: [
                { name: "Last Name", type: "checkbox", title: "Is Married", sorting: false },
                { name: "Gender", type: "text", width: 150 },
                { name: "Location Name", type: "text", width: 150 },
                { name: "Company Name", type: "text", width: 150 },
                { name: "Title Name", type: "text", width: 150 },
                { name: "Title Std Function Vectorized", type: "text", width: 150 },
                { name: "Profile_Title", type: "number", width: 50 },
                { name: "Profile_Url", type: "text", width: 200  },
                { name: "First_Name", items: db.countries, valueField: "Id", textField: "Name" },
                  { type: "control" ,width: 100, editButton: false, deleteButton: false,
             itemTemplate: function(value, item) {
                var $result = jsGrid.fields.control.prototype.itemTemplate.apply(this, arguments);

                var $customEditButton = $("<button>").attr({class: "fa fa-phone"})
                .click(function(e) {

                  get_profile(); -->This is function call

                  e.stopPropagation();
                });

Basically I want a two button is last colum.On clicking on contact button it will fetch data from db and show another button if data is present.




Aucun commentaire:

Enregistrer un commentaire