We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

grid How do I get all the values?

hello How do I get all the values?ü
I found this code but I did not get the values
thank you

$("#GridProductStores").ejGrid("getRows");



$("#GridProductPrices").ejGrid({
        dataSource: data,
        allowPaging: true,
        allowSorting: true, 
        pageSettings: { pageSize: 8 },
        allowFiltering: true,
        height: "150px",
        isResponsive: true,
        isResponsive: true,

        editSettings: { allowEditing: true, allowAdding: true, allowDeleting: true, },
        toolbarSettings: { showToolbar: true, toolbarItems: [ej.Grid.ToolBarItems.Add, ej.Grid.ToolBarItems.Edit, ej.Grid.ToolBarItems.Delete, ej.Grid.ToolBarItems.Update, ej.Grid.ToolBarItems.Cancel] },

        contextMenuSettings: {
            enableContextMenu: true, contextMenuItems: [],
            customContextMenuItems: [
                { id: 'delete', text: "Seçili Hareketi Sil" },
            ]
        },
        columns: [
                { field: "ProductID", visible: false },
                { field: "PriceID", visible: false },
                { field: "Name", headerText: "Fiyat Adı", width: 80, priority: 2 },
                { field: "Price", headerText: "Fiyat", width: 30, priority: 2 },
                { field: "Currency", headerText: "Döviz", width: 30, priority: 2 },
        ]
    });

ajax

  var prices = $("#GridProductPrices").ejGrid("getRows");

$.ajax({
            url: '/Product/AddProduct',
            data: JSON.stringify({
                prices : prices 
            }),
            async: false,
            cache: false,
            dataType: "json",
            type: "POST",
            contentType: "application/json; charset=utf-8",
            complete: function () {
            },
            success: function (result) {

            },
            error: function (e) {

            }
        });




4 Replies

BV Bruce Van Horn August 9, 2017 09:59 PM UTC

You need a reference to the grid object, then take a look at the model object - everything will be in there:

var gridObj = $("#Grid").ejGrid("instance");

gridObj.model.dataSource should have the data source in it and from there you can just loop through that and access the fields on the objects to get the values.



TS Thavasianand Sankaranarayanan Syncfusion Team August 10, 2017 05:16 PM UTC

Hi Serdar, 

Thanks for contacting Syncfusion support. 

We have analyzed your query and we suspect that you want to get the record details from Grid. By using the getRows() method we can get the tr elements of current page in Grid. So, if you want to get all the record details from Grid, then we suggest you to follow the previous response updated by Bruce Van Horn. 

You can get the record detail other than Grid’s model DataSource.  

  1. Using the getSelectedRecords() method, we can get the selected record details from Grid.
  2. Using the getCurrentViewData() method, we can get the current page record details from Grid.
  3. Using the getFilteredRecords() method, we can get the filtered records detail from Grid.

Note: If you not satisfied with the solution then share the details of exact scenario that you expecting for record details. 

Refer the help documentation. 




If we misunderstood your query then please get back to us. 

Regards, 
Thavasianand S. 



SE serdar August 26, 2017 07:11 AM UTC

yes its working 

thank you



TS Thavasianand Sankaranarayanan Syncfusion Team August 28, 2017 04:25 AM UTC

Hi Serdar, 
 
We are happy that the problem has been solved at your end. 
 
Please get back to us if you need any further assistance.  
 
Regards, 
Thavasianand S. 


Loader.
Up arrow icon