Code Monkey home page Code Monkey logo

Comments (16)

matt-riemer avatar matt-riemer commented on September 13, 2024 2

Hey again @GaneshMaduranathan

I have your fix here! Upgrade to effective_datatables 2.4.5

Then use

table_column :is_global, filter: { include_blank: false, collection: [['All', 'Global'], ['Yes', 'Yes'], ['No', 'No']] }

from effective_datatables.

GaneshMaduranathan avatar GaneshMaduranathan commented on September 13, 2024 1

Hello,

I need one more quick help on showing the select options in table header in case of boolean fields.

Say, the column name in the table is "required" with true/false values. The way the column getting rendered in the table is with options "Required,Yes,No", How can I change that to "All,Yes,No" in setting up the datatable properties in the path "app/models/effective/datatables/file_name.rb"

Thanks Again !!!

from effective_datatables.

GaneshMaduranathan avatar GaneshMaduranathan commented on September 13, 2024 1

In this case, there will be four options in the select box. "IsArchived","Yes","No","All".

I don't want "IsArchived" instead I need it to be "All".

that means only three options in the select box. "All","Yes","No".

Ex: I have a boolean column named :is_global.

When Showing in select box, now it is,

  • IsGlobal
  • Yes
  • No

But I need like,

  • All
  • Yes
  • No

Overriding search functionality is not a problem !!!

from effective_datatables.

GaneshMaduranathan avatar GaneshMaduranathan commented on September 13, 2024 1

` Global All Yes No `

I don't want the first option - <option value="">Global</option> .

I need like below:

` All Yes No `

from effective_datatables.

matt-riemer avatar matt-riemer commented on September 13, 2024 1

I added the include_blank and placeholder support, so you can pass both values straight into simple_form

from effective_datatables.

matt-riemer avatar matt-riemer commented on September 13, 2024

Hey @GaneshMaduranathan

Glad you're getting use out of the gem! :)

I agree that the CSS you posted would definitely hide the checkboxes. That CSS doesn't come from this gem tho!

Good luck!! hehe

from effective_datatables.

GaneshMaduranathan avatar GaneshMaduranathan commented on September 13, 2024

My bad.

Is there anyway I can do INLINE edit on each row and save?

Thanks!

from effective_datatables.

matt-riemer avatar matt-riemer commented on September 13, 2024

Hey again,

Nope, this effective_datatables gem doesn't have any kind of inline edit support.

The underlying javascript library does have this feature as a paid option:

https://editor.datatables.net/

Or you could write your own javascript to pop up a modal dialog, edit a row, then update the row and/or call refresh on the underlying datatable.

https://github.com/code-and-effect/effective_datatables/blob/master/app/assets/javascripts/effective_datatables/bulk_actions.js.coffee

could be a good place to start

from effective_datatables.

matt-riemer avatar matt-riemer commented on September 13, 2024

Try

table_column :is_archived, filter: { values: ['Yes', 'No, 'All'] }

and then you might need to override the search function as per

https://github.com/code-and-effect/effective_datatables#customize-filter-behaviour

from effective_datatables.

GaneshMaduranathan avatar GaneshMaduranathan commented on September 13, 2024

Hello,

Is there any update you have me on this?

from effective_datatables.

matt-riemer avatar matt-riemer commented on September 13, 2024

Are you just trying to change the filter bar collection?

table_column :is_global, filter: { collection: ['All', 'Yes', 'No'] }

Then you could do something like

def search_column(collection, table_column, search_term, sql_column)
  if table_column[:name] == 'is_global'
    collection.where('is_global ILIKE ?', "%#{search_term}%")
  else
    super
  end
end

from effective_datatables.

GaneshMaduranathan avatar GaneshMaduranathan commented on September 13, 2024

Actual:

actual

filter: { collection: ['All', 'Yes', 'No'] } will give me something like this:

filter

What I need:

expected

Please check the screenshots I have attached. I need that "All" label to behave like "Global". The first option in the select box always has the "table column's name" (here the column label is "global"). Instead I want that to be "All".

from effective_datatables.

matt-riemer avatar matt-riemer commented on September 13, 2024

This is just calling the simple_form f.input :global, as: :select in the background. So any collection you would pass to simple_form will work here. Maybe what you want is:

table_column :is_global, filter: { collection: [['Global', 'All'], ['Yes', 'Yes'], ['No', 'No']] }

from effective_datatables.

matt-riemer avatar matt-riemer commented on September 13, 2024
table_column :is_global, filter: { collection: [['All', 'Global'], ['Yes', 'Yes'], ['No', 'No']] }

from effective_datatables.

mallikarjunayaddala avatar mallikarjunayaddala commented on September 13, 2024

Thanks @matt-riemer!

from effective_datatables.

GaneshMaduranathan avatar GaneshMaduranathan commented on September 13, 2024

There you are !!!!! Simply Awesome !!!!

Thanks a ton @matt-riemer :)

from effective_datatables.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.