locked
How to show scrollbar in listView added with Blend into HTML/Javascript project

    Question

  • So I added the listView into my Visual Studio 2012 HTML/Javascript project using the Blend and bind with my data that data shows in listView as different items. Now I want to show scrollbar on load, every time when all items can't get into listView. How can I get the selection property using Javascript code?

    Friday, January 11, 2013 6:41 AM

Answers

  • Hi Milan,

    The code should be as follow:

    var listViewInput1 = document.getElementById("listViewInput").winControl;

    listViewInput1.style.scrollbarShow = true;



    Roy
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    • Marked as answer by Song Tian Thursday, January 17, 2013 8:35 AM
    Tuesday, January 15, 2013 6:43 AM

All replies

  • Hi,

    For example, you can preselected as follow:

    var listview = document.getElementById("basicListView").winControl;  
    //select the items  
    listview.selection.set([2,3,4]);  


    Roy
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Friday, January 11, 2013 8:34 AM
  • Hi Roy,

    I do not want to preselect items in listView.  I want to show slider (scrollbar) on load, every time when all items can't get into listView. How can I turn on slider (scrollbar) using Javascript code every time when all items can't get into listView?

    Saturday, January 12, 2013 12:17 AM
  • So I added the listView into my Visual Studio 2012 HTML/Javascript project using the Blend and bind with my data that data shows in listView as different items. Now I want to show scrollbar on load, every time when all items can't get into listView. How can I turn on slider (scrollbar) using Javascript code every time when all items can't get into listView?
    • Merged by Song Tian Monday, January 14, 2013 2:45 AM same thread
    Sunday, January 13, 2013 1:21 AM
  • Hi Milan,

    Then please refer to my reply at: http://social.msdn.microsoft.com/Forums/en-US/winappswithhtml5/thread/560de01c-5b7a-4306-a8ef-b8b932ff5a3d/ .


    Roy
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Monday, January 14, 2013 2:43 AM
  • Hi Roy. Can you fix the code below? how to show scrollbar from javascript

    var listViewInput1 = new WinJS.UI.ListView();
    listViewInput1 = document.getElementById("listViewInput");
    listViewInput1.style.scrollbarShow = true;

    Tuesday, January 15, 2013 6:04 AM
  • Hi Milan,

    The code should be as follow:

    var listViewInput1 = document.getElementById("listViewInput").winControl;

    listViewInput1.style.scrollbarShow = true;



    Roy
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    • Marked as answer by Song Tian Thursday, January 17, 2013 8:35 AM
    Tuesday, January 15, 2013 6:43 AM
  • Hi Roy,

    The style .scrollbarShow does not exist.

    I have 20 listView items. Only 10 can be viewed. When I pull mouse over the listView, the scrollbar shows and I can see the rest items. Looks nice.  But, how can I show the scrollbar all the time (no need to pull mouse over listView to be shown?

    Thank you!


    • Edited by Milan LLC Wednesday, January 23, 2013 7:51 PM
    Wednesday, January 23, 2013 7:51 PM