OK, a little bit more infor if anyone can help:

Have a requirement for get jeditable working with a grid/ table (sqlform.grid 
or slqtable). Current issue is that using the jeditable.js, return 
parameters seems incorrect i.e. editable td value is the indicator 
parameter rather than what should have been passed as the edited text given 
the following *view* scenario 

{{response.files.append(URL('static','js/jquery.jeditable.js'))}}

{{extend 'layout_bs.html'}}

<script> 

jQuery(document).ready(function(){

         jQuery('.EDit').editable("{{=URL('update')}}",{ 

      style: 'display: inline',

      indicator : "1", //returns this value rather that the user edited 
value. Originally "<img src='img/indicator.gif'>" as per jeditable demos

      tooltip   : "Click to edit...",

      style  : "inherit" });alert('tested!');})  

</script>

{{=form}}

{{=response.toolbar()}}

 

Files attached are the jeditiable.js script downloaded from github, model, 
controller, view.

*Model:*

 db.define_table('WSProb',

  Field('Name','string',label='Name'),

  Field('FP','integer',label='Fp',default=0)) 

*Controller:*

def style(v,s1):

    if v==0: s1="background-color:#CFECEC"  

    elif v==2: s1="background-color:#FFFFEA"

    else: s1="background-color:#FFFF00"

    s1=s1+"; text-align:center"

    return s1

 

def probs():

  s1=[]

  t1=[]

  value=0

  db.WSProb.FP.represent = lambda value, row: DIV(value, _class="EDit", 
_style=style(value,s1), _id=str(row.id)+'.FP')

  query = db.WSProb.id>0

  db.WSProb.id.readable=False

  fields = (db.WSProb.id, db.WSProb.Name, db.WSProb.FP)

  table = SQLFORM.grid(db.WSProb, fields=fields, searchable=False)

  return dict(form = table) 

Understanding from documentation was that the DIV id and value was passed 
to the targeted url: i.e.

def update():

    if request.args:

      loc = request.args[0].split['.']

      id = loc[0]

      column = loc[1]

      value = request.args[1]

      db(db.WSprob.id==id).update(column=value)

      #response.flash = 'value updated'

      return value

The update controller should update the table with the edited value.

-- 



Reply via email to