1. #1
    Sencha User
    Join Date
    Jan 2011
    Location
    Lincoln RI
    Posts
    97
    Vote Rating
    0
    webarnie is on a distinguished road

      0  

    Default adding a checkbox to a ListView column

    adding a checkbox to a ListView column


    I have a listView with several columns. Two of the columns are true false, so I would like to display check boxes. In Ext designer, I have right licked on the column and chosen transform ListView Boolean column. The data is either “Y” or “N” and displays as either true or false. How can I get this to render as a checkbox? I also do not want the user to be able to change the data.

  2. #2
    Sencha - Desktop Packager Dev Team jarrednicholls's Avatar
    Join Date
    Mar 2007
    Location
    Baltimore, MD.
    Posts
    1,745
    Vote Rating
    7
    jarrednicholls will become famous soon enough jarrednicholls will become famous soon enough

      0  

    Default


    You could paste a template string into the "tpl" configuration for your column. That would be the easiest way most likely.

  3. #3
    Sencha User
    Join Date
    Jan 2011
    Location
    Lincoln RI
    Posts
    97
    Vote Rating
    0
    webarnie is on a distinguished road

      0  

    Default


    I tried using tpl and the checkbox displayed in the column and all were unchecked. The data has some checked and others unchecked. Also I was able to check and uncheck the checkbox. To implement the checkbox in a column, I suspect you need to right click on the column and transform it to a ListView BooleanColumn?

    Then add the tpl?
    Could you tell me or give me an example of what the tpl should be?
    Do i need to add a listener? not sure how to do this with ext designer. Could you tell me how?

    Thank you.

  4. #4
    Sencha - Desktop Packager Dev Team jarrednicholls's Avatar
    Join Date
    Mar 2007
    Location
    Baltimore, MD.
    Posts
    1,745
    Vote Rating
    7
    jarrednicholls will become famous soon enough jarrednicholls will become famous soon enough

      0  

    Default


    In the template, you can do conditional logic based on the boolean value. Let's say the field name is "active", you can do a conditional template like this:

    Code:
    <input type="checkbox" disabled="disabled" <tpl if="active">checked="checked"</tpl> />
    At least that's the gist of it. Does that makes sense? You can read more on XTemplates here, just expand the constructor line to see the details and examples.

  5. #5
    Sencha User
    Join Date
    Jan 2011
    Location
    Lincoln RI
    Posts
    97
    Vote Rating
    0
    webarnie is on a distinguished road

      0  

    Default


    Yes what you are saying make sense. The data in the field is either “Y” or “N”, so I guess this is not a Boolean field as I previously stated. I am using a ListView column adding the tpl for the checkbox. I change the code a bit but I think I’ve got the syntax wrong. I have 3 rows and only the second should be checked. I am getting all rows checked. I have looked for examples but have not had much luck. Could you tell me what I am doing wrong. Also could you point me to any good references for this? Thank you.

    Code:
    <input type="checkbox" disabled="disabled" <tpl if="dividendPolicy === 'Y'">checked="checked"</tpl> />
    

  6. #6
    Sencha - Desktop Packager Dev Team jarrednicholls's Avatar
    Join Date
    Mar 2007
    Location
    Baltimore, MD.
    Posts
    1,745
    Vote Rating
    7
    jarrednicholls will become famous soon enough jarrednicholls will become famous soon enough

      0  

    Default


    That looks correct to me. Are you sure dividendPolicy is not "Y" for all records? Is the field type in the store on "auto" or on "boolean"? If it's on boolean, try setting it to auto.

  7. #7
    Sencha User
    Join Date
    Jan 2011
    Location
    Lincoln RI
    Posts
    97
    Vote Rating
    0
    webarnie is on a distinguished road

      0  

    Default


    yes i have it working now! Thank you so much.

  8. #8
    Sencha - Desktop Packager Dev Team jarrednicholls's Avatar
    Join Date
    Mar 2007
    Location
    Baltimore, MD.
    Posts
    1,745
    Vote Rating
    7
    jarrednicholls will become famous soon enough jarrednicholls will become famous soon enough

      0  

    Default


    Terrific, good to hear

  9. #9
    Sencha User
    Join Date
    Jun 2007
    Posts
    21
    Vote Rating
    0
    Twain is on a distinguished road

      0  

    Default


    I´m testing a list based on the same code with a few change:

    Code:
    <input type="checkbox" <tpl if="selected === 'Y'">checked="checked"</tpl> />
    I can´t check or uncheck the checkboxes. Those who initially was checked stay checked like it was read only.
    Any idea why it happend?
    Thanks.

  10. #10
    Sencha User
    Join Date
    Jun 2007
    Posts
    21
    Vote Rating
    0
    Twain is on a distinguished road

      0  

    Arrow


    Ext.list.ListView is a fast and light-weight implentation of a Grid like view with the following characteristics:
    .......
    no editing
    .......
    "No editing" applies to the elements that are included in the template?

Similar Threads

  1. Adding Checkbox Column to a grid
    By mannyk in forum Ext Designer: Help & Discussion
    Replies: 2
    Last Post: 23 Aug 2010, 10:00 PM
  2. Checkbox Plus ListView
    By erizvi in forum Ext 3.x: Help & Discussion
    Replies: 0
    Last Post: 9 Aug 2010, 5:10 PM
  3. adding checkbox dynamically to a checkbox group
    By muncher in forum Ext 3.x: Help & Discussion
    Replies: 0
    Last Post: 19 Jul 2010, 12:46 PM
  4. [SOLVED] Adding Checkbox column in GridPanel via Ext Designer
    By Nightwish in forum Ext Designer: Help & Discussion
    Replies: 8
    Last Post: 6 Jul 2010, 7:25 PM
  5. how can I add checkbox in ListView's each item?
    By zzsnake in forum Ext 3.x: Help & Discussion
    Replies: 0
    Last Post: 6 Aug 2009, 6:19 AM

Thread Participants: 3

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar