none
Top article in data view sp2010

    Soru

  • Hi All,

            If I want to get the top-most article in DVWP in sp2010, to appear larger (i.e. bigger font / bigger

    image) as compared to the below articles, how can this be achieved ?.

    This is so that we want top most article to be the feature article . (Then as a new article comes the current-

    top goes down and takes normal size.

    Any suggestions?...thanks

    17 Temmuz 2012 Salı 01:18

Yanıtlar

  • Hi Syddd,

    So, first, Please don't use your DVWP. On your home page, add a web part, then choose "Lists or Libraries", then choose your Library web part. the effect is same with your DVWP, when you add a DVWP on your page, you also have to add a source. So, you can replace DVWP with your Library Web part.

    Another things is if you want get the last article, you should get the count of the items. Like the following.

    <script type="text/javascript">  

    ExecuteOrDelayUntilScriptLoaded(getWebSiteData, "sp.js");  

    var context = null;  

    var web = null;  

        function getWebSiteData() {  

            context = new SP.ClientContext.get_current();  

            web = context.get_web();  

            context.load(web);        

         //var list = web.get_lists().getByTitle('qq');// qq is your list name

         //var query = SP.CamlQuery.createAllItemsQuery();

         //var allItems = list.getItems(query);

         //Count = allItems.get_count();

        $("#”+ Count +”").addClass('customstyle');

        }  

         

    </script> 

    I’m afraid you have to learn some ECMA Client Object module and JavaScript and css .

    Please refer to the following link.

    http://praveenbattula.blogspot.com/2010/04/sharepoint-2010-ecmascript-client.html

    Thanks,

    Jack

    26 Temmuz 2012 Perşembe 04:08

Tüm Yanıtlar

  • Hi Syddd,

    1. First you should custom your css style on the page like the folllowing

      .mycustom
        {
            font-size:xx-large;
            font-style:inherit;
        }

    2.Open your Data View Web Part by SharePOint Designer.

    3. You should sort in your Data View Web Par.

    3.Find you Item of Top article, you will find it in <td> tags.

    4.add your custom css style on the td tag like the following.

    <td class="mycustom">

    Thanks,

    Jack

    18 Temmuz 2012 Çarşamba 06:39
  • Hi jack,

               I cant find the top article in sp designer 2010 code, there are <td class="ms-vb" links,

     but none are available for the top article?

    Any suggestion?

    Thnx

    24 Temmuz 2012 Salı 01:12
  • Hi Syddd,

    Your articles is in your data source(SharePoint List). So, If you want to get your top article, please sort your list. Then the first article is your top article.

    So, If I misunderstood you, please let me know if you fell free. Or you can give more detailed description of your question.

    Thanks,

    Jack

    24 Temmuz 2012 Salı 01:48
  • Ok Jack,

               I add articles to Page library, then DVWP picks them for displaying them , i have sorted with latest

    on top. But this process will go on for every created article.

    How can I grab the top-most article, in order to target it via css as you say ?

    Let me know if you need more details!

    Thanks 

    24 Temmuz 2012 Salı 01:59
  • Hi All,

             Can anyone please recommend the approach to the following :-

    I have a div where I have inserted the Data view web part , which brings the articles from the pages

    library.

    For the top article I want to give its row to have more space in the div as compared to the secondary

    articles. How can that be achieved ?

    Any help/suggestion highly appreciated.

    Thanks in advance!

    24 Temmuz 2012 Salı 06:30
  • Hi Syddd,

    Why you are sort your list when you add the article? You can sort your articles on your library view like the following screenshot. If you can don’t know how to use css style, I will show you a link.

    You can refer to the following link.

    http://onlinecoder.blogspot.com/2011/05/using-sharepoint-2010-data-view-web.html

    Thanks,

    Jack

    25 Temmuz 2012 Çarşamba 02:38
  • Hi Jack,

            I sort the data view web part to display the latest created article on top. 

    My only concern is to select the top article from this dataview web part, and give it more space within the div, increase the font for that article as well . I am stuck with this problem. 

    Even I tried :firstchild for that div, but it selects all the articles in that case.

    Any suggestions?..thanks a lot

    25 Temmuz 2012 Çarşamba 04:34
  • Hi Syddd,

    Ok,ok !Now, I will give you the step by setp mothod! Please ensure your environment can connect internet.

    1. put the following code in a txt file, rename the file as "ChangeTitel"

        

        

     <script type="text/javascript" src="http://code.jquery.com/jquery-latest.js"></script>
    <script type="text/javascript">
        $(document).ready(function() {
        $("#1").addClass('customstyle');
        
        });
    </script>
    <style>
        .customstyle
        {
        	font-size:xx-large;
            font-style:inherit;
        }
    </style>

    2. Upload your text file in your SharePoint Shared Documents.

    3. Please go to your library or list, add Content Editor Web Part on the page.

    3.Modify the  Content Editor Web Part attribute of Content Link ,Please copy the following path in that text box.

    /Shared Documents/ChangeTitel.txt

    5.Click Ok button, and same Page .

    Thanks,

    Jack


    25 Temmuz 2012 Çarşamba 07:49
  • Hi Jack,

               Thanks a lot for that

                I added the content editor on the pages library page, but it works for just that page. My DVWP is on the home page, has no effect of that title increment what soever.

    Also, the 1st article is being targetted somehow, but I wish to target the latest (i.e. the last article) in the pages library.

    Any help appreciated

    Regards

    26 Temmuz 2012 Perşembe 00:25
  • Hi Syddd,

    So, first, Please don't use your DVWP. On your home page, add a web part, then choose "Lists or Libraries", then choose your Library web part. the effect is same with your DVWP, when you add a DVWP on your page, you also have to add a source. So, you can replace DVWP with your Library Web part.

    Another things is if you want get the last article, you should get the count of the items. Like the following.

    <script type="text/javascript">  

    ExecuteOrDelayUntilScriptLoaded(getWebSiteData, "sp.js");  

    var context = null;  

    var web = null;  

        function getWebSiteData() {  

            context = new SP.ClientContext.get_current();  

            web = context.get_web();  

            context.load(web);        

         //var list = web.get_lists().getByTitle('qq');// qq is your list name

         //var query = SP.CamlQuery.createAllItemsQuery();

         //var allItems = list.getItems(query);

         //Count = allItems.get_count();

        $("#”+ Count +”").addClass('customstyle');

        }  

         

    </script> 

    I’m afraid you have to learn some ECMA Client Object module and JavaScript and css .

    Please refer to the following link.

    http://praveenbattula.blogspot.com/2010/04/sharepoint-2010-ecmascript-client.html

    Thanks,

    Jack

    26 Temmuz 2012 Perşembe 04:08