Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
400
bind data returned from web service method to igGrid
posted

Hi,

I was having a trouble to bind data returned from a web service method even I read online samples ( I will post my issue laer on). So I decided to try another way.

though the data binding is ok. however, it doesn't do  filtering, and Paging even the features are set. The error is "Microsoft JScript runtime error: Changing the following option after the igGrid has been created is not supported: virtualization". I noticed that this error only popps up when the .ajax is called the second time. that means after the data is bound to #igGrid already.

first of all, why *.ajax is called more than once? second, is there a way to fix it?

here is my code in test.aspx file:

 <script type="text/javascript">
  
     $(function () {
         $('#Button1').click(getDailyTransactions);
     });

     function getDailyTransactions() {
    
       
         $.ajax({

             type: "POST",

             url: "/Vertex/DailyTransactions.asmx/GetDailyTransactions",

             data: "{}",

             contentType: "application/json; charset=utf-8",

             dataType: "json",

             success: function (response) {

                 records = response.d;

                 $("#igGrid").igGrid({
                     virtualization: false,
                     autoGenerateColumns: true,

                     columns: [
            { headerText: "TransactionID", key: "TransactionID", dataType: "number", width: "150px" },
            { headerText: "PlanID", key: "PlanID", dataType: "number", width: "120px" },
            { headerText: "Premium", key: "Premium", dataType: "number", width: "400px" }
           ],

                     dataSource: records,

                     scrollbars: true,
                     height: '400px',
                     features: [
            {
                name: 'Paging',
                pageSize: 5
            },
            {
                name: 'Sorting'
            },
            {
                name: 'Filtering',
                filterDropDownItemIcons: false,
                filterDropDownWidth: 200
            }
           ]
                 });

               
                 $('#dailyTransaction').empty();

                 $.each(records, function (index, record) {

                     $('#dailyTransaction').append('<p><strong>TransactionID: ' + record.TransactionID + '</strong><br />CustomerID: ' +
                                record.CustomerID + '<br />PlanID: ' +
                                record.PlanID + '<br /> Premium: ' +
                                record.Premium + '<br /></p>');
                 });
             },

             failure: function (msg) {
                 $('#dailyTransaction').text(msg);
             }

         });


       

     }

   


    </script>

Parents
No Data
Reply
  • 0
    Offline posted

    this is still not working,

    response 

    "[{"SR No.":1,"Outlet":"Bopal Retail Shop","Invoice Type":"SR","No. of Bills":1,"Gross Amount":-14000.0000,"Discount Amount":0.0000,"Basic Amount":-12727.2730,"CST (Form C)":0.0000,"Excise":0.0000,"PPT":0.0000,"VAT":0.0000,"Ad.VAT":0.0000,"CST":0.0000,"IGST":0.0000,"Service Tax":0.0000,"CGST":-636.3640,"SGST":-636.3640,"Additional Amt":0.0000,"Service Charge":0.0000,"Delivery Charge":0.0000,"Deduction Amt":0.0000,"Round Off Amt":0.0010,"Total Amount":-14000.0000},{"SR No.":2,"Outlet":"Bopal Retail Shop","Invoice Type":"SI","No. of Bills":2,"Gross Amount":14300.0000,"Discount Amount":0.0000,"Basic Amount":12954.5430,"CST (Form C)":0.0000,"Excise":0.0000,"PPT":0.0000,"VAT":0.0000,"Ad.VAT":0.0000,"CST":0.0000,"IGST":20.4500,"Service Tax":0.0000,"CGST":661.3640,"SGST":663.6340,"Additional Amt":0.0000,"Service Charge":0.0000,"Delivery Charge":0.0000,"Deduction Amt":0.0000,"Round Off Amt":0.0090,"Total Amount":14300.0000},{"SR No.":3,"Outlet":"Breaktime Hospitality Wagh Bakri Tea","Invoice Type":"SI","No. of Bills":8,"Gross Amount":2430.0000,"Discount Amount":0.0000,"Basic Amount":2385.6200,"CST (Form C)":0.0000,"Excise":0.0000,"PPT":0.0000,"VAT":187.5000,"Ad.VAT":37.5000,"CST":0.0000,"IGST":0.0000,"Service Tax":103.5000,"CGST":20.1920,"SGST":20.1920,"Additional Amt":0.0000,"Service Charge":0.0000,"Delivery Charge":0.0000,"Deduction Amt":0.0000,"Round Off Amt":0.4970,"Total Amount":2755.0010},{"SR No.":4,"Outlet":"Drive In Road","Invoice Type":"SI","No. of Bills":4,"Gross Amount":630.0000,"Discount Amount":0.0000,"Basic Amount":630.0000,"CST (Form C)":0.0000,"Excise":0.0000,"PPT":0.0000,"VAT":0.0000,"Ad.VAT":0.0000,"CST":0.0000,"IGST":0.0000,"Service Tax":0.0000,"CGST":0.0000,"SGST":0.0000,"Additional Amt":0.0000,"Service Charge":0.0000,"Delivery Charge":0.0000,"Deduction Amt":0.0000,"Round Off Amt":0.0000,"Total Amount":630.0000},{"SR No.":5,"Outlet":"JK - Retail - Own","Invoice Type":"SI","No. of Bills":50,"Gross Amount":5360050.0000,"Discount Amount":200.0000,"Basic Amount":4821453.6790,"CST (Form C)":0.0000,"Excise":0.0000,"PPT":0.0000,"VAT":0.0000,"Ad.VAT":0.0000,"CST":0.0000,"IGST":0.0000,"Service Tax":0.0000,"CGST":269198.3130,"SGST":269198.3130,"Additional Amt":110.0000,"Service Charge":0.0000,"Delivery Charge":0.0000,"Deduction Amt":10.0000,"Round Off Amt":-0.3590,"Total Amount":5359950.0000},{"SR No.":6,"Outlet":"JK - Retail - Own","Invoice Type":"SR","No. of Bills":15,"Gross Amount":-7350.0000,"Discount Amount":0.0000,"Basic Amount":-6681.8180,"CST (Form C)":0.0000,"Excise":0.0000,"PPT":0.0000,"VAT":0.0000,"Ad.VAT":0.0000,"CST":0.0000,"IGST":0.0000,"Service Tax":0.0000,"CGST":-334.0910,"SGST":-334.0910,"Additional Amt":0.0000,"Service Charge":0.0000,"Delivery Charge":0.0000,"Deduction Amt":0.0000,"Round Off Amt":0.0000,"Total Amount":-7350.0000},{"SR No.":7,"Outlet":"Jk - Test","Invoice Type":"SI","No. of Bills":64,"Gross Amount":16549.5000,"Discount Amount":0.0000,"Basic Amount":15782.8719,"CST (Form C)":0.0000,"Excise":0.0000,"PPT":0.0000,"VAT":0.0000,"Ad.VAT":0.0000,"CST":0.0000,"IGST":0.0000,"Service Tax":0.0000,"CGST":383.3395,"SGST":383.3395,"Additional Amt":624.0000,"Service Charge":0.0000,"Delivery Charge":201.0000,"Deduction Amt":114.0000,"Round Off Amt":-0.5537,"Total Amount":17210.9940},{"SR No.":8,"Outlet":"Retail Outlet - Iscon","Invoice Type":"SI","No. of Bills":4,"Gross Amount":2607.0000,"Discount Amount":0.0000,"Basic Amount":2607.0000,"CST (Form C)":0.0000,"Excise":0.0000,"PPT":0.0000,"VAT":0.0000,"Ad.VAT":0.0000,"CST":0.0000,"IGST":0.0000,"Service Tax":0.0000,"CGST":0.0000,"SGST":0.0000,"Additional Amt":0.0000,"Service Charge":0.0000,"Delivery Charge":0.0000,"Deduction Amt":0.0000,"Round Off Amt":0.0000,"Total Amount":2607.0000},{"SR No.":9,"Outlet":"Retail Outlet - Naroda","Invoice Type":"SI","No. of Bills":5,"Gross Amount":1699.0000,"Discount Amount":0.0000,"Basic Amount":1594.0100,"CST (Form C)":0.0000,"Excise":0.0000,"PPT":0.0000,"VAT":0.0000,"Ad.VAT":0.0000,"CST":0.0000,"IGST":50.3750,"Service Tax":0.0000,"CGST":27.1580,"SGST":27.4600,"Additional Amt":0.0000,"Service Charge":0.0000,"Delivery Charge":0.0000,"Deduction Amt":0.0000,"Round Off Amt":-0.0030,"Total Amount":1699.0000},{"SR No.":10,"Outlet":"Waghbakri Tea Lounge","Invoice Type":"SR","No. of Bills":54,"Gross Amount":-6106.0000,"Discount Amount":-160.0000,"Basic Amount":-5677.5568,"CST (Form C)":0.0000,"Excise":0.0000,"PPT":0.0000,"VAT":0.0000,"Ad.VAT":0.0000,"CST":0.0000,"IGST":0.0000,"Service Tax":0.0000,"CGST":-140.7014,"SGST":-140.7754,"Additional Amt":-25.0000,"Service Charge":0.0000,"Delivery Charge":0.0000,"Deduction Amt":-25.0000,"Round Off Amt":-0.9664,"Total Amount":-5960.0000},{"SR No.":11,"Outlet":"Waghbakri Tea Lounge","Invoice Type":"SI","No. of Bills":174,"Gross Amount":47213.1000,"Discount Amount":160.0000,"Basic Amount":44037.3476,"CST (Form C)":0.0000,"Excise":0.0000,"PPT":0.0000,"VAT":0.0000,"Ad.VAT":0.0000,"CST":0.0000,"IGST":0.0000,"Service Tax":0.0000,"CGST":1517.7984,"SGST":1517.9894,"Additional Amt":205.0000,"Service Charge":0.0000,"Delivery Charge":0.0000,"Deduction Amt":92.0000,"Round Off Amt":1.8641,"Total Amount":47188.0000},{"SR No.":12,"Outlet":"Zipbooks Software solution (Ahmedabad)","Invoice Type":"SI","No. of Bills":5,"Gross Amount":2400.0000,"Discount Amount":0.0000,"Basic Amount":2020.1230,"CST (Form C)":0.0000,"Excise":0.0000,"PPT":0.0000,"VAT":0.0000,"Ad.VAT":0.0000,"CST":0.0000,"IGST":79.4110,"Service Tax":0.0000,"CGST":150.2310,"SGST":150.2310,"Additional Amt":0.0000,"Service Charge":0.0000,"Delivery Charge":0.0000,"Deduction Amt":0.0000,"Round Off Amt":0.0040,"Total Amount":2400.0000},{"SR No.":13,"Outlet":"Zipbooks Software solution (Baroda)","Invoice Type":"SI","No. of Bills":4,"Gross Amount":2060.0000,"Discount Amount":0.0000,"Basic Amount":1755.9330,"CST (Form C)":0.0000,"Excise":0.0000,"PPT":0.0000,"VAT":0.0000,"Ad.VAT":0.0000,"CST":0.0000,"IGST":47.6470,"Service Tax":0.0000,"CGST":128.2090,"SGST":128.2090,"Additional Amt":0.0000,"Service Charge":0.0000,"Delivery Charge":0.0000,"Deduction Amt":0.0000,"Round Off Amt":0.0020,"Total Amount":2060.0000}]"

    Uncaught Error: Cannot determine the data source type. Please specify if it is JSON or XML data.
    at Class.dataBind (infragistics.core.js:374)
    at e.(anonymous function).(anonymous function).dataBind (localhost:4994/.../infragistics.lob.js:151:19700)
    at e.(anonymous function).(anonymous function).dataBind (localhost:4994/.../jquery-ui.min.js:6:7983)
    at e.(anonymous function).(anonymous function)._create (localhost:4994/.../infragistics.lob.js:150:14793)
    at e.(anonymous function).(anonymous function)._create (localhost:4994/.../jquery-ui.min.js:6:7983)
    at e.(anonymous function).(anonymous function)._createWidget (localhost:4994/.../jquery-ui.min.js:6:10053)
    at e.(anonymous function).(anonymous function).$.Widget._createWidget (localhost:4994/.../infragistics.core.js:347:19420)
    at e.(anonymous function).(anonymous function).n (localhost:4994/.../jquery-ui.min.js:6:7867)
    at e.(anonymous function).(anonymous function)._createWidget (localhost:4994/.../infragistics.core.js:407:295)
    at e.(anonymous function).(anonymous function)._createWidget (localhost:4994/.../jquery-ui.min.js:6:7983)

Children