Author Topic: How to cancel "left justified"  (Read 3832 times)

pq33user

  • Newbie
  • *
  • Posts: 11
    • View Profile
How to cancel "left justified"
« on: April 23, 2018, 11:03:39 am »
Hi

Even if you input a space at beginning of the cell, space is deleted when you complete the input.
Is it possible to not delete the space?

Thanks in advance.


paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6309
    • View Profile
Re: How to cancel "left justified"
« Reply #1 on: April 23, 2018, 11:45:56 am »
Input is always trimmed.

Please add text-align or text-indent css styles to the cells for stated purpose.

pq33user

  • Newbie
  • *
  • Posts: 11
    • View Profile
Re: How to cancel "left justified"
« Reply #2 on: April 23, 2018, 12:32:49 pm »
Thank you.
I would like to register the inputed space in the database, so I will consider another plan.

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6309
    • View Profile
Re: How to cancel "left justified"
« Reply #3 on: April 23, 2018, 01:03:10 pm »
you can use cellBeforeSave event to get raw value ( including empty spaces at boundaries ) in an editor : https://paramquery.com/pro/api#event-cellBeforeSave

Code: [Select]
cellBeforeSave: function(evt, ui){
var newVal = ui.newVal;
alert(newVal);
},

pq33user

  • Newbie
  • *
  • Posts: 11
    • View Profile
Re: How to cancel "left justified"
« Reply #4 on: April 24, 2018, 06:14:40 am »
Thank you.

By setting the value of ui.newVal to ui.rowdata in the cellSave, it was possible to set the value to include the space.
However, it is trimmed on display.
Is it possible to make the same value on display?

Code: [Select]
cellSave: function (evt, ui) {
    ui.rowData[ui.dataIndx] = ui.newVal;
}

pq33user

  • Newbie
  • *
  • Posts: 11
    • View Profile
Re: How to cancel "left justified"
« Reply #5 on: April 24, 2018, 07:59:44 am »
The problem was resolved by replacing space with " " in the colModel's render event.
Thank you, you've been so helpful.

Code: [Select]
render: function (ui) {
    return { text: ui.cellData.replace(/\s/g, "&nbsp") }
}