Solved

Ext  technology + Grid + HyperLink column...

Posted on 2009-07-10
4
438 Views
Last Modified: 2012-05-07
Hi,
I built an ascx that contains a grid.
I need to add a column that the values inside will be links.
The column is :
 {name: 'Title', type: 'string'}  -----> instead of string, somthing like "URL", or "HyperLink"
This doesn't work, so how can it be done?
Thanks
(the code is below...)
<script language="javascript">
Ext.onReady(function(){
 
    var record = Ext.data.Record.create([
        {name: 'RequestId', type: 'float'},
        {name: 'Id', type: 'string'},
        {name: 'Title', type: 'string'}  ***********HERE I NEED TO CHANGE TO HYPERLINK-TEXT/URL
    ]);    
        
    var xmlStore = new Ext.data.Store({            
        url     : "Services/ExtService.aspx?serviceMethod=GetData",
        reader  : new Ext.data.XmlReader({
            record      : Suppliers, 
            totalRecords: "results"}, record
        )
    }); 
    var pagingBar = new Ext.PagingToolbar({
        pageSize    : 10,
        displayInfo : true,
        displayMsg  : '',
        store       : xmlStore
    });
 
    xmlStore.load();
 
    var sm = new Ext.grid.RowSelectionModel({
        singleSelect: true,
        listeners: {
            rowselect: function(sm, row, rec) {
                  }
        }
    });
    
    var reportsGrid = new Ext.grid.GridPanel({
        cm : new Ext.grid.ColumnModel([
            expander,
            {RequestID: 'RequestId', dataIndex: 'RequestorId', hidden: true},
            {header: 'a',sortable: true, dataIndex: 'Id'},
            {header: 'b',sortable: true, dataIndex: 'Title'}                
        ]),
        plugins             : expander,
        collapsible         : false,
        animCollapse        : false,
        sm                  : sm,
        enableHdMenu        : false,
        enableColumnResize  : false,
        store               : xmlStore,
        height              : 400,
        width               : 850,
        viewConfig          : {forceFit : true, scrollOffset:2},
        autoExpandColumn    : 'SecondarySubject',
        frame               : true,
        title               :'results',
        bbar                : pagingBar,
        tbar:[
        {text:,'show', tooltip:'show', tooltipType: 'title'}, 
        {text:'back', handler: back, tooltip:'new search', tooltipType: 'title'}
        ]
    });
 
    reportsGrid.render('grid-results');    
 
 });
</script>

Open in new window

0
Comment
Question by:udir
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 40

Accepted Solution

by:
mrjoltcola earned 500 total points
ID: 24824303
What is the actual content of the Title field in the Ext record?

I use links in Ext grids but usually use a renderer on the fly. Can you try this method?


			var listColumnModel = new Ext.grid.ColumnModel
			(
				[
					{header: "Full Name", width: 90, sortable: true, dataIndex: 'fullName'},
					{header: "Date of Birth", width: 80, sortable: true, dataIndex: 'birthDateString'},
					{header: "Actions", width: 60, sortable: false, fixed: true, dataIndex: '', renderer: renderActions}
				]
			);
 
 
			function renderActions(value, meta, record)
			{
				var editUrl = baseUri + 'detail/edit.action?id=' + record.data.id;
				
				var html = '<a href="' + editUrl + '"><img src="' + baseUri + '/images/icon/edit.png" width="18" height="18" ext:qtip="Edit"/></a>';
				
				return html;
			}
			

Open in new window

0
 
LVL 1

Author Comment

by:udir
ID: 24824523
Hi,
what is your -  baseUri?
i get an error:  is not define
0
 
LVL 40

Expert Comment

by:mrjoltcola
ID: 24824612
I define it to a struts tag (which is in a sitemesh master page):

       var baseUri = '<s:url value="/"/>';


But that maps to the context root of the application

       var baseUri = '/myapp/';
0
 
LVL 1

Author Comment

by:udir
ID: 24824748
Great!!
Thanks a lot
0

Featured Post

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This article discusses the difference between strict equality operator and equality operator in JavaScript. The Need: Because JavaScript performs an implicit type conversion when performing comparisons, we have to take this into account when wri…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question