javascript - Get/Set value of field in PageBlockTable -


i have pageblocktable in visualforce page, in table allowing users via jquery .sortable rearrange order of rows.

no, want store sorting on page save, have created new parameter on product in salesforce called sort_order number field.

i update field, in table , hidden each time rows dragged, on save stored.

i have following code, trying loop through table , update fields appropriatley, can't work out jquery syntax setting value of field.

here code creates table:

        <apex:pageblock title="selected {!$objecttype.product2.labelplural}" id="selected">             <apex:variable value="{!1}" var="index">               <apex:pageblocktable value="{!shoppingcart}" var="s" id="shopping_cart" rowclasses="cartrow">                 <tr data-sfid="{!index}">                   <apex:column headervalue="{!$objecttype.opportunitylineitem.fields.description.label}">                     <apex:inputfield id="item_description" value="{!s.description}" required="false"/>                 </apex:column>                    <apex:column headervalue="current id">                 <apex:inputfield id="current_id" value="{!s.sort_order__c}" style="width:70px" required="false" onkeyup="refreshtotals();"/>                 </apex:column>                  <apex:column headervalue="updated id" value="{!index}" />                  <apex:column >                     <apex:commandlink value="remove" action="{!removefromshoppingcart}" rerender="selected,searchresults" immediate="true">                         <!-- param how send argument controller, knows row clicked 'remove' on -->                         <apex:param value="{!s.pricebookentryid}" assignto="{!tounselect}" name="tounselect"/>                     </apex:commandlink>                     <apex:variable value="{!index+1}" var="index">                     </apex:variable>                 </apex:column>                  <apex:column headervalue="{!$objecttype.product2.labelplural}" value="{!s.pricebookentry.product2.name}"/>                     <apex:column headervalue="{!$objecttype.opportunitylineitem.fields.quantity.label}">                     <apex:inputfield value="{!s.quantity}" style="width:70px" required="true" onkeyup="refreshtotals();"/>                 </apex:column>                  <apex:column headervalue="{!$objecttype.opportunitylineitem.fields.unitprice.label}">                     <apex:inputfield value="{!s.unitprice}" style="width:70px" required="true" onkeyup="refreshtotals();"/>                 </apex:column>                  </tr>               </apex:pageblocktable>             </apex:variable> 

it "current id" editable field, id of current_id want update.

and far have gotten update script, have looping through rows "selected" id, i'm not sure how update/access value.

$( "[id$=shopping_cart] tbody" ).sortable({                     update: function(event, ui) {                     //init();                     = 0;                     $("[id$=shopping_cart] tbody tr.cartrow").each(function() {                           $this = $(this)                           var value = $(this).find('current_id');                           var value2 = $(value).find('value');                           console.log("checking row " + i);                           console.log(value);                           console.log(value2).value;                           i++;                           });      }) 

help appreciated way more objectivec person javascript/jquery person!

thanks

gareth

$( "[id$=shopping_cart] tbody" ).sortable({             update: function(event, index) {$("[id$=shopping_cart] tbody tr .cartrow").each(function(index, value) {$(value).val(index); });} }) 

Comments

Popular posts from this blog

python - Subclassed QStyledItemDelegate ignores Stylesheet -

java - HttpClient 3.1 Connection pooling vs HttpClient 4.3.2 -

SQL: Divide the sum of values in one table with the count of rows in another -