Author Topic: problem related to editor  (Read 2190 times)

sims4550

  • Pro Economy
  • Newbie
  • *
  • Posts: 2
    • View Profile
problem related to editor
« on: November 15, 2015, 09:23:46 am »
Hi

I have some problem related to editor.
Here is my JSON data.

var itemlist = [
{"id":"A1-B1-2","name":"glove",   "deliverytime":"5",   "unitprice":2},
{"id":"A1-B1-3","name":"cap",   "deliverytime":"5",   "unitprice":3},
{"id":"A1-B2-1","name":"mask",   "deliverytime":"10",   "unitprice":2},
{"id":"A2-B1-4","name":"needle","deliverytime":"11",   "unitprice":1}];

and I describe colModel like below.

var colM=[
{title: "id", dataIndx: "id",
   editor: {
      type:   "select",
      valueIndx:   "id",
      labelIndx:   "name",
      dataMap:   ['deliverytime','unitprice'],
      selectItem:   {on:true},
      options:   itemlist
      }
   },
   render:   function(ui){
      var cellData=ui.cellData;
      var al=itemlist.length;

      for(var i=0;i<al;i++){
         if(cellData==itemlist.id){
            return itemlist.id;
         }
      }
   }
},
{title: "deliverytime", dataIndx: "deliverytime"},
{title: "deliverytime", dataIndx: "unitprice"},
]

When I select "A1-B1-2", I can't select "A1-B1-3" and "A1-B2-1".
However I can select "A2-B1-4".
And I can select "A1-B1-3" and "A1-B2-1" after I select "A2-B1-4".

Probably the problem is I can't select item which has same data.

Is this my code problem  or some kind of bug?

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: problem related to editor
« Reply #1 on: November 16, 2015, 11:48:20 am »
Your code looks incomplete, anyway I don't see the mentioned issue.

It works fine as in this jsfiddle:

http://jsfiddle.net/b58dLhjr/

PS: Please post a jsfiddle or post complete source code surrounded by code tags.

sims4550

  • Pro Economy
  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: problem related to editor
« Reply #2 on: November 17, 2015, 09:25:25 am »
Thank you for reply.
I think probably other part of my program affect the problem.
I will check again my program.

Thank you.