StringEditor js callback

Hello,

I want to limit the number of characters allowed in a datatable column on the js side to prevent a user entering a too large amount of them.

Given a datatable with a tableColumn editor=ed where ed=StringEditor(),

and

ed.js_on_change(‘data’,ed_callback) # i tried also with ‘value’

where

ed_callback = CustomJS(code=""“console.log(‘string changed’);”"")

While the server runs without error, the js callback is not called.

Any workaround or am i doing stg wrong ?

thx !

ok, i guess this is not the right way to go: the string length can be limited on the js side acting on the columndatasource cds

self.cds.js_on_change(‘change:data’, js_callback)

but still, this is not efficient as we have to scan the entirety of the cds for each change of a single row and single column.

if anybody knows a more efficient solution to truncate a user entry in a datatable, let us know

thx

···

On Wednesday, March 1, 2017 at 2:38:22 PM UTC+1, chupach wrote:

Hello,

I want to limit the number of characters allowed in a datatable column on the js side to prevent a user entering a too large amount of them.

Given a datatable with a tableColumn editor=ed where ed=StringEditor(),

and

ed.js_on_change(‘data’,ed_callback) # i tried also with ‘value’

where

ed_callback = CustomJS(code=“”“console.log(‘string changed’);”“”)

While the server runs without error, the js callback is not called.

Any workaround or am i doing stg wrong ?

thx !

I think this is a reasonable ask, but AFAIK it will also require new development. There are some in-light PRs that might make supporting this much easier, though. So, can you make a GH feature request issue to discuss fine-grained change notifications for data tables?

  Issues · bokeh/bokeh · GitHub

In the mean team I think you would need to make a custom extension of some sort (either of the cell editor, or possibly of data table itself) to support specifying a js callback for fine grained changes:

  http://bokeh.pydata.org/en/latest/docs/user_guide/extensions.html

Thanks,

Bryan

···

On Mar 1, 2017, at 08:28, chupach <[email protected]> wrote:

ok, i guess this is not the right way to go: the string length can be limited on the js side acting on the columndatasource cds

self.cds.js_on_change('change:data', js_callback)

but still, this is not efficient as we have to scan the entirety of the cds for each change of a single row and single column.

if anybody knows a more efficient solution to truncate a user entry in a datatable, let us know

thx

On Wednesday, March 1, 2017 at 2:38:22 PM UTC+1, chupach wrote:
Hello,

I want to limit the number of characters allowed in a datatable column on the js side to prevent a user entering a too large amount of them.

Given a datatable with a tableColumn editor=ed where ed=StringEditor(),
and
ed.js_on_change('data',ed_callback) # i tried also with 'value'
where
ed_callback = CustomJS(code="""console.log('string changed');""")

While the server runs without error, the js callback is not called.

Any workaround or am i doing stg wrong ?

thx !

--
You received this message because you are subscribed to the Google Groups "Bokeh Discussion - Public" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/c94b7f8e-ea01-4bf7-9463-335049b82850%40continuum.io\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.