MedicOneSystems / MedicOneSystems/livewire-datatables

Number format when displaying and editing

Open
#246 0 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
PHP
Stars
1.2k
Forks
257
PR merge metrics
No merged PRs in 30d

Description

Hello,
I have a editable field with a float value. I want to display it with the current locale decimal separator and would like inputs to be allowed with both "." and "," as decimal separator.

I tried to use the callback method, but this seems not to work when editable is set.

RIght now I use
NumberColumn::raw('FORMAT (testF,2,''.'de_DE'.'') AS testF')
for displaying the right format, which works, but I think is not very nice.

For editing values with comma as separator I have no solution yet.
How can I do this?
Ideal would be some pre and post processing hooks for the value. Then I could transform it with a little PHP function.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start from the editable NumberColumn path and the NumberColumn::raw FORMAT workaround described in the issue. Trace how values are formatted for display and parsed during editing, then define done as locale-aware display plus accepting both "." and "," as decimal separators, ideally through pre- and post-processing hooks.

Written by the indexing model from the issue text.

Assessment

Tech stack
laravel, php
Domain
frontend, localization
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.