Datatable Styling in LWC | Lightning Web Component

แชร์
ฝัง
  • เผยแพร่เมื่อ 8 ก.ย. 2024
  • In this video, We will learn how to style Lightning Datatable in the lightning web component. We will cover the following topic in this video
    1) Create a new component
    2) Write Apex Class to fetch Account records
    3) Fetch data to LWC from Apex
    4) Create lightning datatable and load the account data to datatable
    5) hide datatable checkbox
    6) add slds text color to the table column
    7) add an icon to the column with positions
    8) add a background color to the column cell using slds colors
    9) upload external CSS to the static resources
    10) loading external CSS to component
    11) adding an external CSS class to the column cell
    12) adding an external CSS class to the table header
    SLDS ICON
    ====================
    www.lightningd...
    SLDS TEXT COLOR
    ====================
    www.lightningd...
    FOR COOL STUFF OF LIGHTNING WEB COMPONENT
    =============================================
    www.salesforce...
    FOLLOW ME -
    FACEBOOK - / salesforcetroop
    LINKEDIN - / nikhilkarkra
    TWITTER - @karkra_nikhil
    This is especially for all the students and IT professional who wants to make their career in Salesforce.
    PLEASE DO LIKE, SHARE AND SUBSCRIBE THIS VIDEO WITH ALL YOUR STUDENT NETWORK, IT NETWORK AND SALESFORCE NETWORK.
    Let everyone learn Salesforce and become a part of our #Ohana.#navigation #lwc #ohana #pagination

ความคิดเห็น • 62

  • @mangeshkadam6707
    @mangeshkadam6707 2 ปีที่แล้ว

    I was Struggling over DataTables. Thank you for this Video and Knowledge 😊

  • @bobbyh1756
    @bobbyh1756 3 ปีที่แล้ว

    Great tutorial.. Was able to un-block myself in few hours :) Great job.

  • @oleslaw12
    @oleslaw12 6 หลายเดือนก่อน

    Great explanation! Thanks!

  • @chetsboy1
    @chetsboy1 ปีที่แล้ว

    Your udemy course on Lwc is epic great

  • @philipphahmann5971
    @philipphahmann5971 ปีที่แล้ว

    Thank you very much, this video is priceless, it helped me a lot!!! also have learnt a lot.

  • @RS_official22
    @RS_official22 4 หลายเดือนก่อน

    thank you 🙏

  • @koushikc2006
    @koushikc2006 3 ปีที่แล้ว +1

    Excellent Session Nikhil..Last couple of months, I followed your videos and leant a lot about LWC. Now I feel more comfortable to work on this topic except the CSS in LWC. Can you please please conduct sessions how to effectively use CSS in LWC.

    • @salesforcetroop
      @salesforcetroop  3 ปีที่แล้ว +2

      In real-time, salesforce enforce us to use SLDS library over custom CSS. if you have issues with any specific topic in CSS let me know. In web world CSS is tougher than JS

  • @RajeshYadav-ki1lf
    @RajeshYadav-ki1lf 3 ปีที่แล้ว

    Great Video, I like your content Nikhil

  • @cutesaravanasree902
    @cutesaravanasree902 ปีที่แล้ว

    Nice bro this is really help for me

  • @johnbritolima
    @johnbritolima 2 ปีที่แล้ว

    Good job, mate. I was able to follow all the steps. Thanks for your video.

  • @RelaxingMusicVibes999
    @RelaxingMusicVibes999 3 ปีที่แล้ว

    Great job Nikel. Really Amazing stuff 👍

  • @shivansawant3347
    @shivansawant3347 2 ปีที่แล้ว

    Appreciate your effort. Quite a useful video. Totally worth it

  • @jokerddlv
    @jokerddlv 3 ปีที่แล้ว

    Great tutorial! Thanks!

  • @alexandermarchik8128
    @alexandermarchik8128 2 ปีที่แล้ว

    Thanks!)

  • @starman9000
    @starman9000 ปีที่แล้ว

    Hi Great video, even after 2 years it is useful. I have a request, how do you apply style to Input element inside datatable? for example if need to reduce the size of the text input how to do ? can you guide me to the right direction? Thank you

  • @pavan.k
    @pavan.k ปีที่แล้ว

    Good job Nikhil,can u pls tell how do we freeze first three columns in standard data table

  • @mozartlabao9406
    @mozartlabao9406 2 ปีที่แล้ว

    Thank for this. is there a way to disable the hover on rows so that i wont have to edit it thru css static resources?

  • @geetagarg1996
    @geetagarg1996 3 ปีที่แล้ว +1

    Hi Nikhil, I want to create a new checkbox type field in the data table and also want to disable based on the some condition of the row. Can you please help me for this?

  • @mediumshrimp9696
    @mediumshrimp9696 2 ปีที่แล้ว

    Great Video, in your example, your data table loads the data throughout the entire page, on my datatable it stops halfway through the page and has a scroll bar, would you know why this is happening?

  • @mayurikate3447
    @mayurikate3447 2 ปีที่แล้ว

    Hi nikhil, you added css for columns , what if I want to apply background color for particular row

  • @vardhinivardhini9527
    @vardhinivardhini9527 2 ปีที่แล้ว

    Can you clarify the doubt - whenever I use column property initialwidth on Columns, the dataTable is not auto adjusting to different screen widths..
    I need the dataTable to be responsive thogh we give different initial widths

  • @ekron8601
    @ekron8601 2 ปีที่แล้ว

    I'm looking for information about put a color to a icon utility, in your example you add utility:up but how make to add color to tat icon. I haven't been able to do it ;'(

  • @siddharthanandy3798
    @siddharthanandy3798 2 ปีที่แล้ว

    How to set row color on row selection? Lets say, I select one row and the row highlighted in yellow.

  • @ivanjdrakov1957
    @ivanjdrakov1957 3 ปีที่แล้ว

    I want to implement a lightning combobox inside a LWC lighting datatable column, is that possible!?
    I tried extending the datatable and added my custom type for a combobox but my combobox now appears inside the column, so. Can't see it when the options show, only half an option is visible!
    Is there a way I can make the all of the combobox be visible when I click it and it opens its options!
    Or should I just go for old-school tables with slds and aura within my LWC!?
    SWEET
    PS: a difficult one this one seems hey.. Lol
    Sweet
    Keep well and be safe bro!
    🛸😁🇧🇬🙏

  • @ianroque3308
    @ianroque3308 2 ปีที่แล้ว

    Hi - in this demo i notice when hovering to column header the background color did not set properly. what is the fix for that?

  • @sharma93anks
    @sharma93anks 3 ปีที่แล้ว

    hi nikhil, is there any way we can embed rich area text in datatables and show formatted text in bold italic as per the record,, i am able to remove html tags,, but data coming out is just plane.. any suggestions

  • @souviksaha5219
    @souviksaha5219 3 ปีที่แล้ว

    Hi Nikhil, can we use internal css which can be loaded inside the wire method

  • @chithraprakash8392
    @chithraprakash8392 ปีที่แล้ว

    Can you upload to navigate to related records from lwc datatable by clicking the name link

  • @anandpaul9067
    @anandpaul9067 ปีที่แล้ว

    how to add view all and onclick open page and show all the rows

  • @sirigowrina4828
    @sirigowrina4828 3 ปีที่แล้ว

    Hi Nikhil,
    How to apply custom CSS for a button which is in Datatable as rowAction! This technique I have tried but no luck :(

  • @rayanbanerjee6174
    @rayanbanerjee6174 2 ปีที่แล้ว

    Hi, is it natural to take too much time to deploy apex class from vs code, i don't get it it is running for a very long time period

  • @DhirajKiranbel
    @DhirajKiranbel 3 ปีที่แล้ว

    Hi Nikhil,
    Thank you for providing a very knowledgeable session.
    I've a question lets say if you are returning AccountwithContacts from the SOQL query, then how you are going to handle "column" attributes of Lightning DataTable
    ex: if you are returning [Select Id,Name,Industry,(Select Id,Name,Phone,Email,Fax from Contacts) FROM Account LIMIT 10];
    then how to assign Account Contacts data to the DataTable.
    Would be great if you would share your thoughts on this.

    • @salesforcetroop
      @salesforcetroop  3 ปีที่แล้ว +1

      you can modify that data that is coming from apex in js using map function according to your need.

    • @pandeAP90
      @pandeAP90 2 หลายเดือนก่อน

      @@salesforcetroop Hi sir , I followed all the steps as mentioned in your video in my existing lwc data-table . The color is coming but only for alternate records i.e for Account1 it is orange but Account 2 it is white and same goes like that . Can you please help on this .

  • @aashishsatwani4567
    @aashishsatwani4567 3 ปีที่แล้ว

    Hi Nikhil,
    Why did you used three dots before item in the statement
    return {...item,"amountColor": amountColor, "iconName":iconName}

    • @salesforcetroop
      @salesforcetroop  3 ปีที่แล้ว

      It's a spread operator which make a new copy of object

  • @dionyc
    @dionyc 3 ปีที่แล้ว

    Hi, thank you for this video which is very good. Is there any limitation of adding a css file within the same component example "datatableDemo.css" instead of importing and using static resources?

    • @salesforcetroop
      @salesforcetroop  3 ปีที่แล้ว +1

      lightning-datatable is a standard component of lwc and you can't change the style of standard component using custom(datatableDemo.css) css files. Only way to apply css to standard component is global css.

    • @dionyc
      @dionyc 3 ปีที่แล้ว

      @@salesforcetroop Thank you

  • @sayeddanish3982
    @sayeddanish3982 2 ปีที่แล้ว

    When I am resizing the column then horizontal scroll bar is coming , how can I remove?.

  • @akramzaki2644
    @akramzaki2644 2 ปีที่แล้ว

    I having an issue while practicing. In console log I can see data has the property 'amountColor' but in UI the color of the data is not changed. Can u pls help me with this.

    • @akramzaki2644
      @akramzaki2644 2 ปีที่แล้ว

      Can someone help me in the above issue.

  • @jayatishukla2880
    @jayatishukla2880 2 ปีที่แล้ว

    How to add custom validation on datatable columns

  • @user-gd6sd3bw7x
    @user-gd6sd3bw7x 7 หลายเดือนก่อน

    how to apply css to table header?

  • @vipeensarode307
    @vipeensarode307 3 ปีที่แล้ว

    can we set custom color apart from error or success, If I want blue or Orange?

    • @nikhilkarkra1810
      @nikhilkarkra1810 3 ปีที่แล้ว

      That you can apply by adding class to css file and that CSS file should be loaded through static resources

  • @raghavendrasharma815
    @raghavendrasharma815 3 ปีที่แล้ว

    Hii Nikhil please let me know how much time I needed to learn LWC for a intermediate level, I am already working as a salesforce professional.

    • @nikhilkarkra6513
      @nikhilkarkra6513 3 ปีที่แล้ว +1

      It's all about practice and problem solving skills. Just learn basics of js and architecture of LWC.

    • @raghavendrasharma815
      @raghavendrasharma815 3 ปีที่แล้ว

      @@nikhilkarkra6513 thanks nikhil, god bless you, all videos are awesome 👍

  • @pavantammali604
    @pavantammali604 ปีที่แล้ว

    Hello nikhil , it was really a good one. And also is it possible to hide or show particular column in data le based on a condition ?
    @salesforcetroop

  • @SBMG2024
    @SBMG2024 2 ปีที่แล้ว

    hi this is not there in your udemy course could you please add it

  • @movieworld9471
    @movieworld9471 3 ปีที่แล้ว

    I didn't understand that why we cannot use css class in lightning database tags?

    • @salesforcetroop
      @salesforcetroop  3 ปีที่แล้ว +1

      LIghtning standard component is tightly coupled and because of there shadow DOM you can't override there CSS by CSS file. You need an global CSS to override those styles.

    • @movieworld9471
      @movieworld9471 3 ปีที่แล้ว

      @@salesforcetroop ok thank-you for informing me, but Lightning Button is also a standard component, but still we can use class for styling it. Then how?

    • @salesforcetroop
      @salesforcetroop  3 ปีที่แล้ว +1

      @@movieworld9471
      .nik{
      color:red;
      background:yellow;
      }
      To standard button also your css will not work.

    • @movieworld9471
      @movieworld9471 3 ปีที่แล้ว

      @@salesforcetroop Thank you so much for your help, its really appreciated!
      Just one question more, like as I know lightning button is also standard component, but still we don't need to use any static css file. We can do css by making css file in that lwc component only.
      But for datatable, we need to use static resource as it is also a standard component.
      So why, and whats the reason behind it. When both are standard one, but still for lightning button, we don't need to use any static resource css file. Thanks.

    • @salesforcetroop
      @salesforcetroop  3 ปีที่แล้ว +1

      @@movieworld9471 standard lightning button you can't style using css file. try that