Code Monkey home page Code Monkey logo

Comments (3)

KenKodz avatar KenKodz commented on June 7, 2024

If I understand your request, you should be able to do this by overriding the _columns.blade.php file.

Currently there is no way to publish the views from this package via an artisan command. However, I have submitted a pull request to make it possible.

Until the pull request is approved, you can manually copy everything in vendor/rappasoft/laravel-livewire-tables/resources/views/ to resources/views/vendor/laravel-livewire-tables/.

The file you'll want to edit is resources/views/vendor/laravel-livewire-tables/includes/_columns.blade.php

from laravel-livewire-tables.

izzyp avatar izzyp commented on June 7, 2024

Consider the column "primary" that is true or false. We might want to change the output to display something else instead of 0 and 1, an option that allows to display an icon, image or basicly a string that allow us to do just that. It will nice if we can include the original value in that string also, this will allow adding some icon or formating to the output text,

This can be done using the ->view() method.

from laravel-livewire-tables.

marbuser avatar marbuser commented on June 7, 2024

Consider the column "primary" that is true or false. We might want to change the output to display something else instead of 0 and 1, an option that allows to display an icon, image or basicly a string that allow us to do just that. It will nice if we can include the original value in that string also, this will allow adding some icon or formating to the output text,

This can be done using the ->view() method.

Can you elaborate on this a bit? How does the view know what the row data is?

Also how can we make it work for any attribute? E.g I have a time stamp and want a view that converts it into a certain date format, or money in cents that I want to display as a formatted string, and how do you maintain the flexibility of different attribute names. For example, say I want to format created_at so I put that in the view. What about if I want to apply the same component to updated_at now, or another custom date attribute name?

Currently to me it seems like I would have to make a separate view for each, and that approach doesn’t seem very flexible and seems far too opinionated for people who want to use this pkg in a bunch of different projects.

I mentioned in another issue I created that this could be made quite significantly better by allowing a callback on the Column::make function that allows you to access the row data and mutate it however you need before it’s displayed in the table.

from laravel-livewire-tables.

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.