0

hi Guys...i have two jquery functions.first one is showing data in grid and we can also update data in grid..
2nd one is filtering data like if we want to see data of 'farhad' so it will bring data according to 'farhad';
i want to merge both functions in one platform like i want to update data in grid and also want to filter data on same grid...

first function code is....

<script type="text/javascript">
        $(document).ready(function () {
            // prepare the data
            var data = {};
            var theme = 'classic';

            var source =
            {
                 datatype: "json",
                 datafields: [
                     { name: 'name'},
                     { name: 'id'}
                ],
                id: 'id',
                url: 'data_qualification.php',          
                updaterow: function (rowid, rowdata, commit) {
                    // synchronize with the server - send update command
                    var data = "update=true&name=" + rowdata.name;// + "&LastName=" + rowdata.LastName + "&Title=" + rowdata.Title;
///                 data = data + "&Address=" + rowdata.Address + "&City=" + rowdata.City  + "&Country=" + rowdata.Country + "&Notes=''";
                    data = data + "&id=" + rowdata.id;

                    $.ajax({
                        dataType: 'json',
                        url: 'data_qualification.php',
                        data: data,
                        success: function (data, status, xhr) {
                            // update command is executed.
                            commit(true);
                        }
                    });     
                }
            };

            var dataAdapter = new $.jqx.dataAdapter(source);

            // initialize jqxGrid
            $("#jqxgrid").jqxGrid(
            {
                width: 280,
                height: 350,
                selectionmode: 'singlecell',
                source: dataAdapter,
                theme: theme,
                editable: true,
                columns: [
                      { text: 'ID', editable: false, datafield: 'id', width: 100 },

                      { text: ' Certificate Name', datafield: 'name', width: 180 }

                  ]
            });
        });
    </script>

2nd function is

script type="text/javascript">
        $(document).ready(function () {
            // prepare the data
            var theme = 'classic';

            var source =
            {
                 datatype: "json",
                 datafields: [
                     { name: 'ShippedDate', type: 'date'},
                     { name: 'ShipName'},
                     { name: 'ShipAddress'},
                     { name: 'ShipCity'},
                     { name: 'ShipCountry'}
                ],
                url: 'data.php',
                filter: function()
                {
                    // update the grid and send a request to the server.
                    $("#jqxgrid").jqxGrid('updatebounddata');
                }
            };      

            // initialize jqxGrid
            $("#jqxgrid").jqxGrid(
            {       
              width : 900,
                source: source,
                theme: theme,
                filterable: true,
                columns: [
                      { text: 'Shipped Date', datafield: 'ShippedDate', cellsformat: 'yyyy-MM-dd', width: 200 },
                      { text: 'Ship Name', datafield: 'ShipName', width: 200 },
                      { text: 'Address', datafield: 'ShipAddress', width: 180 },
                      { text: 'City', datafield: 'ShipCity', width: 100 },
                      { text: 'Country', datafield: 'ShipCountry', width: 140 }
                  ]
            });
        });
    </script>

waiting for solution
Regards..
Farhad Idrees

2
Contributors
5
Replies
6
Views
4 Years
Discussion Span
Last Post by Airshow
0

scenario is that...
i want want to use both functions in one datagrid.....
how can i tell u anymore? for example i want to show data in grid, update data from datagrid, filter data using same datagrid...

0

Some questions to help you :

  • What is the current behaviour?
  • What is the required behaviour?
  • Why are there two separate scripts, each with its own $(document).ready(function() {...}) structure?
  • Do you want to combine the two scripts into one by editing the source?
  • Do you want to keep the two scripts as they are and somehow have some as yet unwritten piece of code combine their functionality?
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.