Author Topic: Float datatype with limit on decimal places  (Read 3972 times)

cijojohn

  • Pro Ultimate
  • Jr. Member
  • *
  • Posts: 73
    • View Profile
Float datatype with limit on decimal places
« on: March 30, 2017, 01:55:30 am »
Hi Team,

I am currently facing below issue with PQ grid. How do i set the copy of cell values on change of some other cell value due to copy paste operation. PFA screenshot.
Let us know if you have any sample code or jsfiddle.

Regards,

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6296
    • View Profile
Re: Float datatype with limit on decimal places
« Reply #1 on: March 30, 2017, 07:25:19 pm »
Please check this sample code: http://jsfiddle.net/eq4qge3b/

1. For different formatting in different rows of same column, column.render is used.

2. change event is used to detect changes in certain cells, and updateRow() is used to update value of any cells.

cijojohn

  • Pro Ultimate
  • Jr. Member
  • *
  • Posts: 73
    • View Profile
Re: Float datatype with limit on decimal places
« Reply #2 on: April 14, 2017, 12:27:57 am »
Hi Team,

Formatting is working fine for the rows having float as dataType. But we are having diff types for each column in each row..In this case user is able to type the alphabets also. Is there way to avoid it like the case when dataType is float.

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6296
    • View Profile
Re: Float datatype with limit on decimal places
« Reply #3 on: April 14, 2017, 10:22:00 am »
you can switch column.dataType in runtime for different cells/ rows to prevent alphabets in certain cells.

Use editorBegin event.

editorBegin: function(evt, ui){
   if(ui.rowData.rank < 10)            
      ui.column.dataType='float';
   else
      ui.column.dataType='string';               
},

« Last Edit: April 14, 2017, 09:53:16 pm by paramquery »