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
620
getCellValue in grid with multiple-column-key
posted

Hello.

I've a grid that has 3 columns as key. When I execute the method getCellValue, an error is thrown saying that can't get 'dataType' from null or undefined. The error is produced in this line:

if(primaryKeyCol.dataType==="number"||primaryKeyCol.dataType==="numeric")

The previous line is this one:

primaryKeyCol=this.columnByKey(this.options.primaryKey);

As this.options.primaryKey has multiple columns, this.columnByKey return null.

How can I do to execute this method?

Parents
No Data
Reply
  • 10685
    Offline posted

    Hello, you could find a short description how to use the getCellValue method in the API documentation.

    For example:
    var date = $(".selector").igGrid("getCellValue", 3, "ShipDate");
    Please notice, the columnKey is used ("ShipDate") as well as rowId, in order to specify the exact cell to get the value of.   

    columnByKey method as well works with the columnKey and returns a column object by the specified column key. 

    It is worth mentioning, the column key and the primary key have different functions.
    column key- Column key (property in the data source to which the column is bound).
    primaryKey - Primary key name of the column containing unique identifiers. It is for example required for functionalities like RowAdding and RowUpdating, so each row could be safely identified as unique. 

    Please let me know if you require further assistance.

Children