[Vtigercrm-developers] Q. on vt7 Detail/Summary view picklists

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[Vtigercrm-developers] Q. on vt7 Detail/Summary view picklists

Alan Lord (News)
I'm wanting to modify the options (remove some) available in a Picklist
using Ajax when in Detail View. (I haven't looked at this in Edit View yet).

Something is a bit odd...

After the first page load, but before you click the pencil icon to edit
the Picklist, none of the option values for the picklist seem to exist
in the DOM.

If I click on the pencil, then close the edit by clicking on the "X",
the values are now in the DOM.

Questions:

How can I update the values of a picklist before any user activity using
Ajax? e.g., Is there an event I can listen for which is populating the
DOM when I click on the pencil edit button?

Is this data reloaded every time that pencil is clicked or can I just
update the picklist once per page load?

Al

_______________________________________________
http://www.vtiger.com/
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Q. on vt7 Detail/Summary view picklists

Alan Lord (News)
OK - can one of the vtiger devs please talk about the "uimeta" API?

My colleague found the list of Picklist options hidden in a Javascript
var. I can read the field info by running, for example:

 > uimeta.field.get('lsdwnld_rate');

What else can I do with this?
Can I "set" it?
Can I tell it to update/re-render?
Does it apply to all fields? (It seems to)...

TIA

Al

On 20/01/17 10:09, Alan Lord wrote:

> I'm wanting to modify the options (remove some) available in a Picklist
> using Ajax when in Detail View. (I haven't looked at this in Edit View
> yet).
>
> Something is a bit odd...
>
> After the first page load, but before you click the pencil icon to edit
> the Picklist, none of the option values for the picklist seem to exist
> in the DOM.
>
> If I click on the pencil, then close the edit by clicking on the "X",
> the values are now in the DOM.
>
> Questions:
>
> How can I update the values of a picklist before any user activity using
> Ajax? e.g., Is there an event I can listen for which is populating the
> DOM when I click on the pencil edit button?
>
> Is this data reloaded every time that pencil is clicked or can I just
> update the picklist once per page load?
>
> Al
>
> _______________________________________________
> http://www.vtiger.com/
>


_______________________________________________
http://www.vtiger.com/
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Q. on vt7 Detail/Summary view picklists

Alan Lord (News)
To answer my own question, No. There isn't any write facilities to the
uimeta var.

I have decided to approach my task in a different direction instead...

But I am still really struggling with the implementation of fields in
vtiger 7...

Please see the attached snippet of a picklist field in Detail View:

http://paste.ubuntu.com/23868473/

Please can a vtiger dev explain the correct way to read the real value
of this field (Not the display value)?

The only place I can see it is inside this span

> <span class="select2-chosen" id="select2-chosen-1">512</span>

But accessing it seems to be overly complex in terms of the amount of
DOM tree one has to traverse to get to it.

Is there an API (in "app" or "helper" for example) for accessing field
values?

My particular query now is for a Picklist, but I guess that depending on
the UIType of the field you want the DOM is going to be very different
for each kind of field...

Thanks

Al



On 20/01/17 16:20, Alan Lord wrote:

> OK - can one of the vtiger devs please talk about the "uimeta" API?
>
> My colleague found the list of Picklist options hidden in a Javascript
> var. I can read the field info by running, for example:
>
>> uimeta.field.get('lsdwnld_rate');
>
> What else can I do with this?
> Can I "set" it?
> Can I tell it to update/re-render?
> Does it apply to all fields? (It seems to)...
>
> TIA
>
> Al
>
> On 20/01/17 10:09, Alan Lord wrote:
>> I'm wanting to modify the options (remove some) available in a Picklist
>> using Ajax when in Detail View. (I haven't looked at this in Edit View
>> yet).
>>
>> Something is a bit odd...
>>
>> After the first page load, but before you click the pencil icon to edit
>> the Picklist, none of the option values for the picklist seem to exist
>> in the DOM.
>>
>> If I click on the pencil, then close the edit by clicking on the "X",
>> the values are now in the DOM.
>>
>> Questions:
>>
>> How can I update the values of a picklist before any user activity using
>> Ajax? e.g., Is there an event I can listen for which is populating the
>> DOM when I click on the pencil edit button?
>>
>> Is this data reloaded every time that pencil is clicked or can I just
>> update the picklist once per page load?
>>
>> Al
>>
>> _______________________________________________
>> http://www.vtiger.com/
>>
>
>
> _______________________________________________
> http://www.vtiger.com/
>


_______________________________________________
http://www.vtiger.com/
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Q. on vt7 Detail/Summary view picklists

Alan Lord (News)
Just to follow up with some more info, the markup linked to below shows
the state of the DOM _after_ you have changed a picklist value in Detail
View.

IMHO this really is not very well implemented.

Bits of that DOM change when you change a picklist option but the key
part of the DOM - which would be the ideal bit to read data from -
doesn't :-(

The line below shows the value *after* I have changed the picklist from
512 to 256.

> <input class="fieldBasicData" data-name="lsfwd_rate" data-type="picklist" data-displayvalue="512" data-value="512" type="hidden">

On screen it now says 256. In the database the field value has been
saved as 256. And in the horrendously-hard-to-grab select2-chosen span
tag referred to earlier it reads (Note: this is the "display value" not
the true value - if this was a translated text string it would not be
usable):

> <span class="select2-chosen" id="select2-chosen-1">256</span>

In the original <select><options...> the option value 512 is still set
as "selected":

> <option value="512" selected="">512</option>

When in fact, I have already clicked the pencil icon, changed the value
to 256 and clicked the tick to save it.

This is *really* hard to deal with...

Al

On 26/01/17 10:32, Alan Lord wrote:

> To answer my own question, No. There isn't any write facilities to the
> uimeta var.
>
> I have decided to approach my task in a different direction instead...
>
> But I am still really struggling with the implementation of fields in
> vtiger 7...
>
> Please see the attached snippet of a picklist field in Detail View:
>
> http://paste.ubuntu.com/23868473/
>
> Please can a vtiger dev explain the correct way to read the real value
> of this field (Not the display value)?
>
> The only place I can see it is inside this span
>
>> <span class="select2-chosen" id="select2-chosen-1">512</span>
>
> But accessing it seems to be overly complex in terms of the amount of
> DOM tree one has to traverse to get to it.



_______________________________________________
http://www.vtiger.com/
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Q. on vt7 Detail/Summary view picklists

Alan Lord (News)
Sorry for all the noise on this but this possible source of the true value:

 > <span class="select2-chosen" id="select2-chosen-1">256</span>

Doesn't actually exist on a picklist field which hasn't been edited :-(

Al


On 26/01/17 10:48, Alan Lord wrote:

> Just to follow up with some more info, the markup linked to below shows
> the state of the DOM _after_ you have changed a picklist value in Detail
> View.
>
> IMHO this really is not very well implemented.
>
> Bits of that DOM change when you change a picklist option but the key
> part of the DOM - which would be the ideal bit to read data from -
> doesn't :-(
>
> The line below shows the value *after* I have changed the picklist from
> 512 to 256.
>
>> <input class="fieldBasicData" data-name="lsfwd_rate"
>> data-type="picklist" data-displayvalue="512" data-value="512"
>> type="hidden">
>
> On screen it now says 256. In the database the field value has been
> saved as 256. And in the horrendously-hard-to-grab select2-chosen span
> tag referred to earlier it reads (Note: this is the "display value" not
> the true value - if this was a translated text string it would not be
> usable):
>
>> <span class="select2-chosen" id="select2-chosen-1">256</span>
>
> In the original <select><options...> the option value 512 is still set
> as "selected":
>
>> <option value="512" selected="">512</option>
>
> When in fact, I have already clicked the pencil icon, changed the value
> to 256 and clicked the tick to save it.
>
> This is *really* hard to deal with...
>
> Al
>
> On 26/01/17 10:32, Alan Lord wrote:
>> To answer my own question, No. There isn't any write facilities to the
>> uimeta var.
>>
>> I have decided to approach my task in a different direction instead...
>>
>> But I am still really struggling with the implementation of fields in
>> vtiger 7...
>>
>> Please see the attached snippet of a picklist field in Detail View:
>>
>> http://paste.ubuntu.com/23868473/
>>
>> Please can a vtiger dev explain the correct way to read the real value
>> of this field (Not the display value)?
>>
>> The only place I can see it is inside this span
>>
>>> <span class="select2-chosen" id="select2-chosen-1">512</span>
>>
>> But accessing it seems to be overly complex in terms of the amount of
>> DOM tree one has to traverse to get to it.
>
>
>
> _______________________________________________
> http://www.vtiger.com/
>


_______________________________________________
http://www.vtiger.com/
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Q. on vt7 Detail/Summary view picklists

Satish Dvnk
In reply to this post by Alan Lord (News)
Hi @alan,

OK - can one of the vtiger devs please talk about the "uimeta" API?

uimeta is nothing but metadata of a field. This will be initialized once in a page(URL). You can check with Vtiger/ModuleHeader.tpl. According to convenience can add some more apis in uimeta.


regards,
Satish.Dvnk


On Fri, Jan 20, 2017 at 9:50 PM, Alan Lord <[hidden email]> wrote:
OK - can one of the vtiger devs please talk about the "uimeta" API?

My colleague found the list of Picklist options hidden in a Javascript var. I can read the field info by running, for example:

> uimeta.field.get('lsdwnld_rate');

What else can I do with this?
Can I "set" it?
Can I tell it to update/re-render?
Does it apply to all fields? (It seems to)...

TIA

Al


On 20/01/17 10:09, Alan Lord wrote:
I'm wanting to modify the options (remove some) available in a Picklist
using Ajax when in Detail View. (I haven't looked at this in Edit View
yet).

Something is a bit odd...

After the first page load, but before you click the pencil icon to edit
the Picklist, none of the option values for the picklist seem to exist
in the DOM.

If I click on the pencil, then close the edit by clicking on the "X",
the values are now in the DOM.

Questions:

How can I update the values of a picklist before any user activity using
Ajax? e.g., Is there an event I can listen for which is populating the
DOM when I click on the pencil edit button?

Is this data reloaded every time that pencil is clicked or can I just
update the picklist once per page load?

Al

_______________________________________________
http://www.vtiger.com/



_______________________________________________
http://www.vtiger.com/


_______________________________________________
http://www.vtiger.com/
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Q. on vt7 Detail/Summary view picklists

Alan Lord (News)
On 30/01/17 06:52, Satish Dvnk wrote:
> Hi @alan,
>
> OK - can one of the vtiger devs please talk about the "uimeta" API?
>
> uimeta is nothing but metadata of a field. This will be initialized once
> in a page(URL). You can check with Vtiger/ModuleHeader.tpl. According to
> convenience can add some more apis in uimeta.

Thanks for the followup.

I managed to resolve these problems by handling all the modifications
before page load in my Module's models. It meant extending the Detail
Index View models but it "feels" like it is the right place to do this ;-)


Alan


_______________________________________________
http://www.vtiger.com/
Loading...