Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

checkbox invisible in bulk action #18

Closed
GaneshMaduranathan opened this issue May 11, 2016 · 16 comments
Closed

checkbox invisible in bulk action #18

GaneshMaduranathan opened this issue May 11, 2016 · 16 comments

Comments

@GaneshMaduranathan
Copy link

GaneshMaduranathan commented May 11, 2016

@matt-riemer

Thanks for this beautiful plugin.

I added the bulk action implementation and when I see the table, the checkboxes are not visible.

It looks like the below css (in materialize.css) is making it invisble.

[type="checkbox"]:not(:checked), [type="checkbox"]:checked {
position: absolute;
left: -9999px;
visibility: hidden;
}

When I remove the position and visibility attributes, I can see the checkbox.

Am I missing anything?

Thanks!!!

@matt-riemer
Copy link
Member

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

@GaneshMaduranathan
Copy link
Author

My bad.

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

Thanks!

@matt-riemer
Copy link
Member

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

@GaneshMaduranathan
Copy link
Author

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 !!!

@matt-riemer
Copy link
Member

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

@GaneshMaduranathan
Copy link
Author

GaneshMaduranathan commented Jun 1, 2016

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 !!!

@GaneshMaduranathan
Copy link
Author

Hello,

Is there any update you have me on this?

@matt-riemer
Copy link
Member

matt-riemer commented Jun 6, 2016

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

@GaneshMaduranathan
Copy link
Author

GaneshMaduranathan commented Jun 7, 2016

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".

@matt-riemer
Copy link
Member

matt-riemer commented Jun 7, 2016

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']] }

@GaneshMaduranathan
Copy link
Author

GaneshMaduranathan commented Jun 8, 2016

` Global All Yes No `

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

I need like below:

` All Yes No `

@matt-riemer
Copy link
Member

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

@matt-riemer
Copy link
Member

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']] }

@matt-riemer
Copy link
Member

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

@mallikarjunayaddala
Copy link

Thanks @matt-riemer!

@GaneshMaduranathan
Copy link
Author

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

Thanks a ton @matt-riemer :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants