jqGrid rowid naming conflict during save - jqgrid

I need some help with jqGrid. I have a table with the primary key column named 'id'. It seems that there is naming conflict with jqGrid when the inline edit does ajax post back to save data. The rowid used as the unique identifier is also named 'id' in jqGrid.
Is it possible to change the default rowid variable name to something else, such as '_id' to avoid naming conflict? Did I miss something?

There are different ways to solve your problem.
You can not change the id name used in jqGrid, but you can rename any parameters of ajax requests. For example you can use prmNames: {id:"_id"} option of jqGrid.
If you have a column in the table which has primary key and which can be used to identify a grid row, you can set key: true in the column definition. As a result the column with key: true will be used by jqGrid instead of additional id. Moreover this option can be used also to reduce the size of data (see Jqgrid 3.7 does not show rows in internet explorer as an example).

Related

Backpack Laravel select2_from_ajax field returns results, but I can't select any

I'm implementing a 'select2_from_ajax' field using Backpack for Laravel.
I've implemented this in other places and it works correctly. But for some reason when implementing it this time it will not let me select any of the options and doesn't show the highlight when mousing over the options. It lists out the options correctly, I just can't select any of them.
The only thing I can think of is that the relationship it's trying to reference doesn't have a primary 'id' field in the database, but I'm not sure why that would affect this.
I have implemented both the index and show routes.
The issue was that the relationship field's primary key was not 'id' it was setup with a different column name.
I reworked the data structure so the foreign key referenced was pointing to a column labeled 'id'.

DATA_LENGTH_0 in maintenance view

I created a view for a client-independent customizing table. The primary key consists of three components - first one being a secondary key on a check table. It is also used to form subsets of the table data. Altogether, it looks something like this:
Column Key
------ --------
frmd Secondary check table and Subset
attr1 KEY
attr2 KEY
url
But everytime I try to insert a new key combination, the view dumps with DATA_LENGTH_0 CX_SY_RANGE_OUT_OF_BOUNDS, because the report tries to access a string. Apparently it is somehow related to the field generictrp being set. What does this flag tell me and how do I change it? Also non-key components like url are not being fetched - the column is totally empty.
Modifying the customizing table via transaction SM30 works fine, but I don't want that ugly first column.
I've tried to recreate the view multiple times and I also compared the settings with existing customizing views.
Access is set to read,change, delete and insert
Display/Maintenance is allowed
Selecting everything from the View with SELECT works fine
EDIT
Picture 1: what I have
Picture 2: what I want; without the first key column...
The most likely reason I faced this problem, is that I had a foreign key of type i. I changed the type to n and regenerated everything.
Seems to work for now.

Dynamically setting MaxLength property of a DataColumn with DataAdapter

I have a datatable that I'm filling with SqlDataAdapter.Fill(). Is there a way to dynamically assign the MaxLength property to each string datacolumn to the maximum allowed by that column in the database?
So I googled for a while and found that the DataAdapter has another method besides Fill which is: FillSchema(), which includes the database schema into the DataTable. Since all I wanted to bring was the MaxLength property what I did was load the schema into another table and loop through the columns assigning the value to each one.
Of course if you wanted to keep all the constraints in the database within your table, then you'd need no loop and just load the schema into the datatable.
PedroC88's answer worked. To clarify the code needed for any newbies. Just above my adapters fill method, I wrote the fillschema method. The (SchemaType)2 argument is required. There are 2 different schematypes (1 and 2) and 2 is recommended as it applies existing table mappings (though I have no idea what this means).
myAdapter.FillSchema(dataTable, (SchemaType)2);
myAdapter.Fill(dataTable);
In this code 'myAdapter' is the name of my adapter and 'dataTable' is the name of my data table.

problem with 'datatable' jquery plugin and two table (ajax related)

i have two tabs that their content loads by ajax. both have a table in their content. i want to apply 'datatable' jquery plugin to both table. tables have the same id because they are create by a function.but their rows are different.
datatable plugin is applied to first tab table well but on the second one give this error:
"DataTables warning (table id = 'dttable'): Cannot reinitialise DataTable.
To retrieve the DataTables object for this table, please pass either no arguments to the dataTable() function, or set bRetrieve to true. Alternatively, to destory the old table and create a new one, set bDestroy to true (note that a lot of changes to the configuration can be made through the API which is usually much faster)."
i use "bDestroy":true in datatable plugin define.but in this way the plugin doesn't show in second table.
would you help me?
Your problem is that both tables have the same ID, which is invalid HTML. When you try to initialize the second Databable, your selector only finds the first table and tries to initialize Datatables on the first table again, which results in the error that you are getting.
You need to change your function to create each table with a unique ID and initialize each table by its respective ID.
Why not set the Datatables by a className rather than ID then it can apply to both of them?
When retrieving the data you can use something like $('.dataTableStyle').eq(1) to get information from the relevant one.
I'm using mvc3 and my problem was with initializing a dataTable in a view, then rendering a partial view with another dataTable. The issue was not in the id's of the 2 tables, but in the way the partial views get rendered in the framework. In my case, I had to move the script, or reference to the script, into the view that hosts the partial view. I had an issue similar to this using the Google Maps api.
try this code
$(document).ready(function() {
oTable = $('#DataTables_Table_0').dataTable({ //DataTables_Table_0 <-------table id
iVote: -1, //your field name
"bRetrieve":true
});
oTable.fnSort( [ [1,'desc'] ] );
});
use this in function event when you would change your table data
$('#tbl_resultates').dataTable().fnDestroy();
and add
"bRetrieve": true,
in
$('#tbl_resultates').dataTable({

ORACLE APEX Question on using Update / Save Button

I've created an APEX page based on a single table, which is then called by a another APEX page with a field value to be queried.
The page displays the record, which has a Primary Key consisting of 2 fields.
When I use the Update/Save button, it appears not to update the data, though it does not return any errors.
This works OK on other APEX pages where they are based on Tables with a single field Primary Key.
I would appreciate an explanation/solution from anyone who has had a similar problem and found a workaround.
Thanks in advance
Your page should have a "Process Row of MYTABLE" process. Have a look in the details of the process, you'll find that it has the following attributes:
Item Containing Primary Key Column Value
Primary Key Column
Item Containing Secondary Key Column Value
Secondary Key Column
Your process should include both Primary and Secondary Keys.

Resources