Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I have a list which is shown in gridview (Quick Edit in the ribbon). Now i want to disable one column with jQuery.

This might be possible by applying the attribute

aria-readonly="true"

to the correct element.

For example a disabled column looks like this:

<td style="vertical-align: middle; border-right: 1px solid rgb(198, 198, 198); 
border-bottom: 1px solid rgb(198, 198, 198); color: rgb(177, 177, 177); 
font-family: &quot;Segoe UI&quot;,&quot;Segoe&quot;,Tahoma,Helvetica,Arial,sans-serif; 
font-size: 13px; font-weight: bold; font-style: normal; text-align: start; 
background-color: rgb(253, 253, 253);" class="ms-cellstyle ms-vb2" role="gridcell" 
aria-selected="true" aria-readonly="true" id="spgridcontainer_WPQ2_0_3_8" 
aria-describedby="spgridcontainer_WPQ2_0_8"><span>Germany</span></td>

A normal (editable) column looks like this:

<td style="vertical-align: middle; border-right: 1px solid rgb(198, 198, 198); 
border-bottom: 1px solid rgb(198, 198, 198); color: rgb(68, 68, 68); 
font-family: &quot;Segoe UI&quot;,&quot;Segoe&quot;,Tahoma,Helvetica,Arial,sans-serif; 
font-size: 13px; font-weight: 400; font-style: normal; text-align: left;" 
class="ms-cellstyle ms-vb2" role="gridcell" 
aria-selected="false"><span>Not Started</span></td>  

Can somebody jump onboard and help me with the correct jQuery commands to select the column and apply the attributes?

share|improve this question
    
how can You solved the problem? –  user18748 Aug 6 '13 at 14:38

2 Answers 2

This isn't the most dynamic solution but it should work... replace col_index with the column number... could add more before the "td" selector, such as the container id or class name to make the selection more fine-tuned.

$('tr>td[role="gridcell"]:nth-child(col_index)').attr("aria-readonly","true");
share|improve this answer

Expression might be ok but aria-readonly does not disable a field in quick edit view.

share|improve this answer
2  
Hi Rob! Can you please try to add more details to your post? Right now it is not very helpful :) –  Robert Lindgren Feb 5 at 13:11

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.